GATE Computer ScienceVery hardGATE CSE · NIELIT

How many states does the canonical LR(0) collection of the augmented grammar S′ → S; S → a S b | a b have, and how many of them have a shift-reduce or reduce-reduce conflict (LR(0) conflicts)? Give the answer as (states, conflicting states).

  1. A. (6, 0)
  2. B. (6, 1)
  3. C. (7, 0)
  4. D. (5, 1)

Correct answer: A. (6, 0)

Building the item sets gives 6 states. No state mixes a completed item with another item, so the grammar is LR(0) and there are 0 conflicting states.

More Compiler Design questions

Exams that ask this topic