Subtopic 3 of 4
4.3The LL(1) table and the LL(1) condition
Put A → α in M[A, a] for each a in FIRST(α) (and for each a in FOLLOW(A) if α is nullable). The grammar is LL(1) iff no cell has two entries.
Load example
| M[A, a] | ( | ) | * | + | id | $ |
|---|---|---|---|---|---|---|
| E | T E' | T E' | ||||
| E' | ε | + T E' | ε | |||
| T | F T' | F T' | ||||
| T' | ε | * F T' | ε | ε | ||
| F | ( E ) | id |
No cell has two entries: this grammar is LL(1).
Rule A → α is entered at M[A, a] for every a in FIRST(α); and for every a in FOLLOW(A) if α is nullable. Each cell shows the right-hand side.
Previous year questions: Top-down Parsing (LL(1)) (5)
PYQs are grouped by topic, so this is the full set for Top-down Parsing (LL(1)); try the ones that match this subtopic. Open all 5 on the topic page.