edited by
11,675 views
29 votes
29 votes

Consider the following grammar

  • $S  \rightarrow S * E$
  • $S  \rightarrow E$
  • $E  \rightarrow F + E$
  • $E  \rightarrow F$
  • $F  \rightarrow id$

Consider the following LR(0) items corresponding to the grammar above

  1. $S  \rightarrow S *.E$
  2. $E   \rightarrow F. + E$
  3. $E   \rightarrow F + .E$

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

  1. i and ii
  2. ii and iii
  3. i and iii
  4. None of the above
edited by

6 Answers

0 votes
0 votes
Since in first production s->s*.E, in this state the production of E will be there similarly in other 2 also productions can't be together for the same reason.
0 votes
0 votes

D. is the answer. 

Also, it is not LL(1) as it is left recursive and also it is not LR(0) because there is shift-reduce conflict and hence it is not SLR(1), LALR(1), CLR(1).

Answer:

Related questions

33 votes
33 votes
4 answers
4