Rules
Grammar:
rule TOP { <integer> <addop> <integer> {*} } token integer { \d+ {*} } token addop { [ '+' | '-' ] {*} }
Result:
$ ./calc --target=parse > 12 + 45 "parse" => PMC 'Calc;Grammar' => "12 + 45\n" @ 0 { <integer> => ResizablePMCArray (size:2) [ PMC 'Calc;Grammar' => "12" @ 0, PMC 'Calc;Grammar' => "45" @ 5 ] <addop> => PMC 'Calc;Grammar' => "+" @ 3 }