in Compiler Design edited by
1,881 views
8 votes
8 votes
Consider the following context-free grammar
S → SS + | SS*| a

It is

a)LL(1)

b)LR(0)

c)Both

d)none
in Compiler Design edited by
1.9k views

4 Comments

construct 2 different tree for same string then ?!
0
0

Given grammar is left recursive doesn't implies it is an ambiguous grammar. A grammar is ambiguous if it is left recursive and right recursive. The given grammar is not right recursive as there exist a terminal in the end of every production.

https://gateoverflow.in/84491/ambiguity

0
0

2 Answers

4 votes
4 votes
Best answer
Its a LR(0) grammer so answer is B. No RR or SR conflicts.

Wrong answer was given in ace test series. This grammer is unambiguous because only one parse tree is possible for any string generated by it.

Having more than one expansion have nothing to do with ambiguity.
selected by

1 comment

I am gettong sr conflict
0
0
0 votes
0 votes
  • Given grammar is left recursive . And if a grammar is left recursive then it never be LL(1).

  • Given grammar is LR(0) HENCE SLR also . So option b is true .