LL(1) Table Generation
1. If
For every production A
in the grammar:
can derive a string starting with
a (i.e., for all a in FIRST(
) ,
Table [A, a] = A
2. If
can derive the empty string,
, then, for all b that can follow
a string derived from A (i.e., for all b in FOLLOW (A) ,
Table [A,b] = A
TE' from the non-left-recursive, left-factored
expression grammar in Example 4.
FIRST(TE') = { (, Id }, so
Table[E,(] = E
TE' and Table[E,Id] = E
TE'.
from the same grammar of Example 4.
Since ";", ")" and "$" are in FOLLOW (E'), this production occurs in the
table in the row labeled E', and under the columns labeled ";", ")", and "$".
) and FOLLOW(A). Then, when the grammar is input, A and
are identified for each production and the two steps above followed to
create the table.