Arrange the following parsers in increasing order of their power of handling…
2025
Arrange the following parsers in increasing order of their power of handling grammars i.e. from the least powerful parser to the most powerful parser.
A. LR(0)
B. LR(1)
C. LALR(1)
D. LL(0)
E. SLR
Choose the correct answer from the options given below:
- A.
LL(0) → LR(0) → SLR → LR(1) → LALR(1)
- B.
SLR → LR(0) → LL(0) → LR(1) → LALR(1)
- C.
LL(0) → LR(0) → SLR → LALR(1) → LR(1)
- D.
LR(0) → LL(0) → SLR → LR(1) → LALR(1)
Attempted by 80 students.
Show answer & explanation
Correct answer: C
The power of a parser refers to the class of grammars it can successfully parse.
LL(0) (D)
No lookahead symbol is used.
Very restrictive; can handle only the simplest grammars.
Least powerful among the given parsers.
LR(0) (A)
Bottom-up parser with no lookahead.
More powerful than LL(0) but still limited due to frequent conflicts.
SLR (E)
An improvement over LR(0).
Uses FOLLOW sets to resolve reduce actions.
Can parse more grammars than LR(0).
LALR(1) (C)
Uses 1-symbol lookahead.
Combines states of LR(1) parsers with identical cores.
More powerful than SLR and widely used in practice (e.g., YACC).
LR(1) (B)
Uses 1-symbol lookahead with full context.
Can handle the largest class of deterministic context-free grammars.
Most powerful parser in the list.
A video solution is available for this question — log in and enroll to watch it.