Skip to content
Related Articles

Related Articles

GATE | GATE-CS-2006 | Question 85

View Discussion
Improve Article
Save Article
  • Last Updated : 15 Sep, 2021

Consider the following grammar.

S -> S * E
S -> E
E -> F + E
E -> F
F -> id

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

(i) S -> S * .E
(ii) E -> F. + E
(iii) E -> 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?
(A) (i) and (ii)
(B) (ii) and (iii)
(C) (i) and (iii)
(D) None of the above

Answer: (D)

Explanation: Let’s make the LR(0) set of items. First we need to augment the grammar with the production rule S’ -> .S , then we need to find closure of items in a set to complete a set. Below are the LR(0) sets of items.

LR(0) items

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!