GATE Computer ScienceVery hardGATE CSE

Grammar: S → L = R | R; L → * R | id; R → L (augmented with S' → S). How many states do the LR(0) automaton and the canonical LR(1) automaton have, and how many states does the LALR(1) automaton have?

  1. A. 10, 14 and 14
  2. B. 11, 14 and 10
  3. C. 10, 16 and 11
  4. D. 10, 14 and 10

Correct answer: D. 10, 14 and 10

LR(0) has 10 states; canonical LR(1) splits some into 14; merging LR(1) states with equal cores returns 10, the same as LR(0).

More Compiler Design questions

Exams that ask this topic