• retagged by
1,701 views
1 1 vote

Consider the following CFG:

$S\rightarrow Aa\mid ca$

$A\rightarrow c\mid d$

How many conflict occur in $CLR\left ( 1 \right )$ Parsing construction ?


I think $LR\left ( 0 \right )$ there is $1$ conflict, but in $SLR\left ( 1 \right )orCLR\left ( 1 \right )$ there won’t be any conflict. Someone verify it.

1 Answer

0 0 votes

Grammer is not CLR(1) because it have Shift-Reduce conflict. 

S->c.a $   (Shift production)

A->c.   a  (Reduce production)

The shift reduce condition in CLR(1) is that Shifting symbol should not be appearing look ahead list of reducing production.

Here 'a' is shift in 1st production and  it also appear look ahead list of 2nd production.

 

And another alternative grammer is ambiguous it  have 2 parse tree for the string 'ca' if the grammer is ambigious it can not be CLR(1) 

Position:
Show:

Related questions

0 0 votes
1 1 answer
2.4k
2.4k views
Souvik33 asked Jan 1, 2023
2,397 views
Let G be any grammar with the following productions:X → X+Y | YY→ Y*Z | ZZ → (X)Z → idIf LR(1) parser is used to parse the above grammar, then total how many look-a-heads...
1 1 vote
2 2 answers
2.2k
2.2k views
Meghashyam Sujay asked Dec 4, 2016
2,245 views
Consider the following CFG.S $\rightarrow$aAb|aBc|bAd|bBeA$\rightarrow$gB$\rightarrow$gThe number of states exist in DFA using LALR (1) construction for the above grammar...
1 1 vote
1 1 answer
1.3k
1.3k views
anon1 asked Dec 31, 2021
1,253 views
How to solve this ? Please help.
0 0 votes
1 1 answer
695
695 views
worst_engineer asked Jan 9, 2016
695 views
I did in this way :There is conflict , right ? As A - g. and B - g. both going to $ and gConsider the following CFG.\[\begin{array}{l}\mathrm{S} \rightarrow \mathrm{aA}|a...