GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 1.26

Parser grammar-class inclusion

Compiler Design · Parsing & Syntax Analysis · Full GATE CSE 1998 paper

GATE 1998, Q1.26 1 mark · MCQ
Report issue

Parsing & Syntax Analysis

Question 1.26, GATE 1998: Which is true about SLR, LALR, canonical LR power? C says canonical LR is more powerful than LALR.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Canonical LR(1) retains separate lookahead contexts. LALR merges LR states with identical LR(0) cores; this can introduce reduce/reduce conflicts that did not exist before merging. SLR uses the still coarser FOLLOW-set reduction rule. Therefore the recognizable grammar classes satisfy SLR⊆LALR⊆canonical LR, with proper inclusions in general, giving C. This compares conflict-free grammar handling, not table compactness or parsing speed.

Original paper, page 3