retagged by
884 views
2 votes
2 votes
Ques.  S --> Aa/bAc/dc

           A --> d

Which of them is correct. Please provide detailed information.

a) LALR(1) but not SLR(1)

b) Both SLR(1) and LALR(1)

c) Grammar is Ambiguous

d) Neither SLR(1) NOR LALR(1)
retagged by

2 Answers

2 votes
2 votes

We have to construct LR parsing table,

For SLR(1) parsing table, we have to find all LR(0) items and make sure that no item should contain either SR/RR conflict, then grammar is SLR(1). 

Similarly for LALR(1), we need to find all LR(1) items.

For the above question ,

the LR(1) items are,

For LR(0) items, we will get SR conflict due to productions S->dc and A->d,

 hence grammar is LALR(1) but not SLR(1).

Correct me if i am wrong.

0 votes
0 votes
there's nothing in that look,

while finding canonical form of LR(0) item that is SLR(1) we come up vit an SR conflict in I4 state but upon finding the follow we deduce that conflict. so its an SLR(1).

 And coming to the LALR(1)  there is an SR conflict again in I4 state but its easily eradicated because here there is an LOOKAHEAD sybl which doesn't not participate in conflict max number of blank spaces are seen soo here  the grammer satisfies LALR(1)..

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
Shyam Singh 1 asked Dec 10, 2016
1,517 views
Every SLR grammar is unambiguous. True or False? Why?
2 votes
2 votes
1 answer
3
reena_kandari asked Aug 14, 2017
494 views
Is this grammar ambiguous?S >SxA|AA >AyB|BB >zB|(S)|m|nI cant prove it ambiguos.As this grammar is not in LR(1) it may or may not be ambiguous.
1 votes
1 votes
1 answer
4