Subtopic 3 of 6
5.3SLR(1)
Same states as LR(0). Reduce A → α only on terminals in FOLLOW(A). FOLLOW is an over-estimate, so SLR can report conflicts that real lookaheads would avoid.
| State | ACTION | GOTO | |||||
|---|---|---|---|---|---|---|---|
| * | = | id | $ | S | L | R | |
| 0 | s4 | s5 | 1 | 2 | 3 | ||
| 1 | acc | ||||||
| 2 | s6/r5 | r5 | |||||
| 3 | r2 | ||||||
| 4 | s4 | s5 | 8 | 7 | |||
| 5 | r4 | r4 | |||||
| 6 | s4 | s5 | 8 | 9 | |||
| 7 | r3 | r3 | |||||
| 8 | r5 | r5 | |||||
| 9 | r1 | ||||||
1 conflict(s): state 2 on =: s6/r5. Not SLR(1).
sN = shift to state N, rN = reduce by production N (production 0 is S′ → S). SLR reduces A → α only on FOLLOW(A).
Previous year questions: Bottom-up Parsing (LR family) (12)
PYQs are grouped by topic, so this is the full set for Bottom-up Parsing (LR family); try the ones that match this subtopic. Open all 12 on the topic page.