GATE Computer ScienceVery hardGATE CS (PYQ pattern)

For S → b A d | c A e | b B e; A → x; B → x (augmented), how many ACTION cells of the SLR(1) table are multiply defined, and how many reduce entries does the LALR(1) table contain ($ column included, accept excluded)?

  1. A. 1 and 6
  2. B. 1 and 8
  3. C. 2 and 6
  4. D. 0 and 6

Correct answer: A. 1 and 6

FOLLOW(A) = {d, e}, FOLLOW(B) = {e}. After b x the state is {A → x·, B → x·}: SLR puts both reductions under e: 1 clash. With LR(1) lookaheads that state reduces A on d and B on e; after c x only A → x· on e; plus S → b A d·, S → c A e·, S → b B e· on $: 6 entries and no clash (the two x-states have different cores, so LALR = LR(1)).

More Compiler Design questions

Exams that ask this topic