LR grammar examples

Observe that for the examples from the literature, the state numbers are different because of the way they are generated in our tool. Additionally, the steps of the derivations display GOTO actions explicitly.

LR(0) basic example from Grune et al.

LR(0) shift/reduce example from Grune et al.

LR(1) version of the above.

LR(1) basic example from Grune et al.

LR(1) Example 3.26 from Appel

LR(1) Grammar 3.1 from Appel with example matching 3.18

LR(1) dangling else

LR(1) arithmetic expression with shift/reduce

LR(1) arithmetic expression with modified grammar for precedence and left associativity

LR(1) arithmetic expression with modified grammar for precedence and right associativity


The examples on this page are auto-generated with dOvs teaching LR parser generator tool. The tool and the webpage is maintained by Aslan Askarov.