GATE Computer ScienceEasyGATE CS (PYQ pattern)

How many distinct LR(0) items does the grammar E → E + T | T; T → T * F | F; F → ( E ) | id have (do not augment it; an ε-production gives exactly one item)?

  1. A. 20
  2. B. 18
  3. C. 12
  4. D. 19

Correct answer: B. 18

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

More Compiler Design questions

Exams that ask this topic