Drawtomata / SLR, CLR and LALR parsing table generator

SLR, CLR and LALR parsing table generator

Type a grammar above and choose LR(0), SLR(1), CLR(1) or LALR(1). Drawtomata builds the canonical collection of items, draws the automaton, fills in ACTION and GOTO, marks every conflict and traces a shift-reduce parse.

Which table is which

Conflicts

A shift-reduce conflict means a cell asks for both a shift and a reduce; a reduce-reduce conflict means two reductions. Ambiguous expression grammars can be fixed with yacc-style %left and %right precedence, which the tool applies when you tick the box.

Classic examples

S → CC, C → cC | d is LR(0) and so in every class. S → L = R | R, L → *R | id, R → L is LALR(1) but not SLR(1). Both are in the example list above.