LR Tutorbeta

This is the first term we are using this tool. There may still be bugs.
Please do not hesitate to reach out to Michael Schwarz (m.schwarz [at] tum.de) if you find a bug! Please include the grammar file you used and the saved automaton in your email.

About

LR tutor is a tool to help students understand the creation of canonical LR automata. You can input a custom grammar and select whether you want to build an LR(0) or LR(1) automaton. While creating the automaton you can always check whether the automaton is already correct.

It was developed for the Compiler Construction lecture at TUM i2 by Leo Fahrbach for his Bachelor's thesis, advised by Dr. Michael Petter and Michael Schwarz. The code can be found on github.

Grammar


        
  • Use '->' or '➜' as arrow
  • (Non-)Terminals can have multiple characters, use any whitespace to delimit (Non-)Terminals.
  • S' is always the start nonterminal. If S' does not exists, the nonterminal on the left of the first production is considered the start symbol, and a new production starting with S' is introduced.
  • | is used as delimiter.
  • •, ➜, Ɛ, |, $, S', ->, ., {, }, and ',' cannot be used as (Non-)Terminals.
  • To write epsilon you can leave the right hand side empty, or write Ɛ, e.g. S-> |s is equivalent to S-> Ɛ |s.
or Here are some example automata.

Here are some example automata.
Adding Transition
  1. select a beginning state
  2. choose the (Non-)Terminal for the transition
  3. click on a state to end the transition at this state or click on the canvas to create a new state
  • Only one outgoing transition for each (non-)terminal is allowed per state. If a transition with the same (non-)terminal already exists the old one gets deleted.

LR Items
  • LR(0) items form: A➜a•b
  • LR(1) items form: A➜a•b {x, y}
  • A➜ab is a production of the grammar
  • x, y are terminals or '$'
  • . is automatically replaced with •
  • -> is automatically replaced with ➜
  • every whitespace is ignored, hence between (Non-)Terminals does not need to be a space, like in the grammar definition. Of course it should still be deterministic, what production of the grammar it uses.

Editing LR Items
  • Double click on an LR item to edit the item
  • Double click on a state to add a new LR item to the end of the state

Edit States
  • Click on the canvas to add a new state
  • Add a transition, which creates a new state
  • Use 'del' or the button to delete selected states or transitions. The start state cannot be deleted.
  • Use 'f' or the button to toggle the final status of a state

Side bar
  • The side is used to show or hide buttons to edit the automaton. If the automaton was checked, the errors will be shown on the side bar.
  • Errors are not hidden automatically, even if the automaton was edited
Compose a transition with the following (Non-)Terminal:
Impressum