GATE / CS ARCHIVE

GATE CSE 2017 SET 2 / QUESTION 6

GATE CSE 2017 Set 2 Q6

Compiler Design · Parsing & Syntax Analysis · Full GATE CSE 2017 Set 2 paper

GATE 2017 Set 2, Q6 1 mark · MCQ
Report issue

Parsing & Syntax Analysis

Question 6, GATE 2017: Which parser-power 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. A:I only. B:II only. C:III only. D:II and III.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Power here refers to the class of grammars handled without parsing conflicts, with the usual one-symbol lookahead versions. The inclusion chain is SLR(1) ⊂ LALR(1) ⊂ canonical LR(1).

2. SLR uses coarse FOLLOW sets for reductions. Canonical LR uses item-specific lookahead information; LALR merges compatible LR state cores and retains more discrimination than SLR but can lose some canonical LR power.

3. Thus canonical LR can handle every SLR grammar and some additional grammars, making I true. II and III reverse the inclusion direction and are false. Choose A. This comparison is about grammar recognition capability, not parser speed or table size.

Original paper, page 3 · Answer key