GATE Computer ScienceVery hardGATE CSE

For S → C C; C → c C | d (augmented), the canonical LR(1) collection has some states that share an LR(0) core. By how many states does LALR(1) construction shrink the collection?

  1. A. 2
  2. B. 4
  3. C. 3
  4. D. 6

Correct answer: C. 3

Canonical LR(1) has 10 states; merging same-core states leaves 7, i.e. 3 fewer (the pairs {C→c.C, C→.cC, C→.d}, {C→d.} and {C→cC.} each appear in two lookahead variants).

More Compiler Design questions

Exams that ask this topic