GATE Computer ScienceHardGATE CSE · NIELIT

For S → L = R | R; L → * R | id; R → L, how many states of the LR(0) automaton contain a conflict that SLR(1) fails to resolve?

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

Correct answer: D. 1

In the state containing S → L . = R and R → L . the symbol = is in FOLLOW(R) (since L → * R and R → L put R wherever L can appear, and L is followed by =), so SLR(1) cannot decide between shifting = and reducing; this is the only such state, giving 1.

More Compiler Design questions

Exams that ask this topic