GATE / CS ARCHIVE

GATE CSE 2015 SET 3 / QUESTION 15

GATE CSE 2015 Set 3 Q15

Compiler Design · Parsing & Syntax Analysis · Full GATE CSE 2015 Set 3 paper

GATE 2015 Set 3, Q15 1 mark · MCQ
Report issue

Parsing & Syntax Analysis

Question 15, GATE 2015: Among simple LR (SLR), canonical LR and look-ahead LR (LALR), identify, in order, the easiest method to implement and the most powerful method. Options: (A) SLR, LALR; (B) canonical LR, LALR; (C) SLR, canonical LR; (D) LALR, canonical LR.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. SLR uses one FOLLOW set for all reductions of a nonterminal, whereas canonical LR keeps the lookahead specific to each item/context. LALR merges compatible LR states for smaller tables but may introduce conflicts that canonical LR avoids.

2. SLR uses LR(0) states plus FOLLOW sets and is the simplest of the three. Canonical LR(1) retains item-specific lookaheads and recognizes the broadest grammar class. Thus SLR, canonical LR, C.

Original paper, page 58 · Answer key