Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2006 | Question 85

  • Last Updated : 15 Sep, 2021
Geek Week

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :