Computer Science EngineeringVery hardISRO SC

Consider the grammar E -> E+E | E*E | id. In its LR(0) automaton (augmented grammar), how many states contain a shift/reduce or reduce/reduce conflict when reduce actions are placed under every terminal?

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

Correct answer: D. 2

Inspect each state: a complete item together with a shift item or another complete item is an LR(0) conflict. Count = 2.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic