GATE Computer ScienceVery hardGATE CS (PYQ pattern)

For S → A b B | c; A → a | ε; B → c B | ε (augmented), in how many LR(0) states is there a conflict, and how many reduce entries does the SLR(1) table have ($ column included, accept excluded)?

  1. A. 2 states; 7 entries
  2. B. 3 states; 9 entries
  3. C. 3 states; 7 entries
  4. D. 1 state; 5 entries

Correct answer: C. 3 states; 7 entries

Conflicting LR(0) states: I0 (A → · beside shifts on a and c), the state after A b (B → · beside shift c), and the state after c inside B (B → c·B, B → · beside shift c). SLR reduce entries: A → ε and A → a on FOLLOW(A) = {b}: 2; S → c· on $; B → ε in two states on $; B → c B· on $; S → A b B· on $: 2 + 1 + 2 + 1 + 1 = 7.

More Compiler Design questions

Exams that ask this topic