A grammar is LL(1) if (roughly) you can unambiguously decide which grammar rule to use from
exactly one token of lookahead. Although LL parsers have some shortcomings,
they are easier to understand than LR parsers, which have always seemed to me like reaching into your left
pocket with your right hand: it gives you the right result but is quite contorted.
An LL(1) grammar is well suited to table-based parsing. This page implements all the steps
in constructing and using such a table.
Try It Yourself
A simple LL(1) grammar is provided, along with a correct line of code. (You can change the grammar; instructions below.)
Click to derive all the required sets and construct the parse table.
Or, click each button sequentially.
Click to initialize the parser.
Click repeatedly to parse the source code.
Table Builder
Grammar
Terminals
Terminals will go here
Non-terminals
Non-terminals will go here
Nullables
Nullables will go here
FIRST(A) = { t : (t ≠ ε & A →* tβ) | (t = ε & A →* ε) }
FIRST set will go here
FOLLOW(A) = { t : (t ≠ $ & S →+ αAtβ) | (t = $ & S →* αA) }