Build the canonical collection of LR(0) item sets, compute FIRST and FOLLOW, use FOLLOW sets to place reductions in an SLR(1) parsing table, and parse an input one action at a time.

Edit or enter a grammar

ASCII syntax: use ->, |, and epsilon. Separate symbols with spaces. A symbol appearing on a left-hand side is a nonterminal; every other symbol is a terminal.

Canonical collection

LR(0) item sets

Transitions on grammar symbols

DFA recognizing viable prefixes

The DFA is identical to the LR(0) machine. SLR(1) changes where completed items place reductions in the parsing table.