Drawtomata / FIRST and FOLLOW calculator

FIRST and FOLLOW calculator

Type a grammar above, one production per line, such as E -> E + T | T. Drawtomata computes FIRST and FOLLOW for every nonterminal and shows how the sets grow pass by pass.

Rules

FIRST(X) is the set of terminals that can begin a string derived from X, plus ε if X can derive ε.

FOLLOW(A) is the set of terminals that can appear right after A in some sentential form.

Apply the rules until no set changes. FIRST and FOLLOW are what the LL(1) table and the SLR table are built from.