Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Compiler Design
  • LR parsing
  • Medium

Which ordering of the classes of grammars parsable by these LR parsers is correct?

Parsing

Pick an option to check your answer.

Each step uses more lookahead information. LR(0) uses none; SLR adds FOLLOW sets; LALR uses precise per-state lookaheads (merged); CLR keeps full LR(1) items. So LR(0)⊂SLR(1)⊂LALR(1)⊂CLR(1)\text{LR}(0) \subset \text{SLR}(1) \subset \text{LALR}(1) \subset \text{CLR}(1).

Why not the others

  • SLR(1)⊂LR(0)\text{SLR}(1) \subset \text{LR}(0) reverses the first two.
  • LALR(1)⊂SLR(1)\text{LALR}(1) \subset \text{SLR}(1) — LALR is strictly more powerful than SLR.
  • CLR(1)⊂LALR(1)\text{CLR}(1) \subset \text{LALR}(1) — merging states can only lose power.

Report an error

GATE CS · Compiler Design · Parsing