SLR(1) Workbench — FOLLOW-Guided Reductions
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.
Reduction lookaheads
reduce A → β only on FOLLOW(A)FIRST and FOLLOW
FOLLOW-guided reductions
SLR(1) parsing table
Separate tokens with spaces;
$ is appended automatically.
← → step
Unread token highlighted
Input
Top at the right
Grammar symbols and DFA states
Orange cell is consulted now
Current ACTION/GOTO lookup
Built by reductions