Expr | Prog(Expr) |
"x" | if (ch == 'x') nextCh(); else error(); |
(E) | Prog(E) |
[E] | if (ch in first(E)) { Prog(E) } |
{E} | while (ch in first(E)) { Prog(E) } |
E F | Prog(E) Prog(F) |
E | F | if (ch in first(E)) { Prog(E) } else { Prog(F) } |
first(E) is the set of terminals, E can start with.
Q: What is first(BinNumber)?
If we use multiple rules, each rule gives one procedure.