Skip to content

Instantly share code, notes, and snippets.

@cono
Created September 8, 2017 18:38
Show Gist options
  • Save cono/30bd6392856626771c747ddaa29471b0 to your computer and use it in GitHub Desktop.
Save cono/30bd6392856626771c747ddaa29471b0 to your computer and use it in GitHub Desktop.
grammar SimpleCalc {
token TOP {
^^ <expr> $$
}
token expr {
<number> | <tree-op>
}
token tree-op {
<expr> <op> <expr>
}
token number { \d+ }
token op { '+'|'-' }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment