retagged by
684 views
1 votes
1 votes

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.

retagged by

1 Answer

0 votes
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) 

Related questions

0 votes
0 votes
1 answer
3
worst_engineer asked Jan 9, 2016
335 views
I did in this way :There is conflict , right ? As A - g. and B - g. both going to $ and g
1 votes
1 votes
1 answer
4