The GATE Grind

GATE 2017 CS (CS2) – Question 16

Compiler Design · Parsing and Syntax Analysis · 1 mark · Multiple choice

Which parser statements are correct? I: Canonical LR is more powerful than SLR. II: SLR is more powerful than LALR. III: SLR is more powerful than Canonical LR.

  1. I only
  2. II only
  3. III only
  4. II and III only

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) I only

Explanation

The grammar-class inclusion is SLR(1) ⊂ LALR(1) ⊂ canonical LR(1). Canonical LR retains full LR(1) lookahead context; SLR uses the coarser FOLLOW sets. Thus only I is true, A.

More Parsing and Syntax Analysis questions

All Parsing and Syntax Analysis questions →