GATE Computer ScienceModerateGATE CS (PYQ pattern)

Consider these claims about LR parsers. I. Merging LR(1) states with the same core can create a shift-reduce conflict that the canonical LR(1) parser does not have. II. Merging can create a reduce-reduce conflict that canonical LR(1) does not have. III. The LALR(1) and SLR(1) automata have the same number of states as the LR(0) automaton. IV. Every LR(0) grammar is SLR(1).

  1. A. I, II and III only
  2. B. II and IV only
  3. C. II, III and IV only
  4. D. I, III and IV only

Correct answer: C. II, III and IV only

Merging cannot introduce shift-reduce conflicts (the shift items depend only on the core), but it can introduce reduce-reduce ones, as in S → a A d | b B d | a B e | b A e, A → c, B → c. SLR and LALR use the LR(0) core automaton, and LR(0) ⊂ SLR(1).

More Compiler Design questions

Exams that ask this topic