Rules
token TOP { <integer> <addop> <integer> {*} } token integer { \d+ {*} } token addop { [ '+' | '-' ] {*} }
Our current grammar doesn't handle whitespace:
$ ./calc --target=parse > 12 + 45 Failed to parse source
Whitespace in regexes is metasyntactic, and ignored by default
The 'rule' keyword says that whitespace in the regex corresponds to whitespace in the input
rule TOP { <integer> <addop> <integer> {*} }