GATE Computer ScienceEasyGATE CS (PYQ pattern)

How many distinct LR(0) items does the grammar S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε have (do not augment it; an ε-production gives exactly one item)?

  1. A. 18
  2. B. 9
  3. C. 17
  4. D. 16

Correct answer: D. 16

A production with right side of length m gives m + 1 items (dot positions); summing over the 7 productions gives 16.

More Compiler Design questions

Exams that ask this topic