GATE Computer ScienceVery hardGATE CS (PYQ pattern)

For the grammar E → E + T | T; T → T * F | F; F → ( E ) | id, the LALR(1) parser is obtained by merging LR(1) states with identical cores. How many more states does the canonical LR(1) automaton have than the LALR(1) automaton?

  1. A. 13
  2. B. 11
  3. C. 9
  4. D. 10

Correct answer: D. 10

LR(1) has 22 states; merging equal-core states leaves 12 (equal to the LR(0) count 12), so the difference is 10.

More Compiler Design questions

Exams that ask this topic