Embedded PIR
Grammar:
regex integer { \d+ {{ print "found an integer " say match }} } regex addop { [ '+' | '-' ] {{ print "found an addop " say match }} }
Result:
$ ./calc --target=parse > 3+4 found an integer 3 found an addop + found an integer 4 "parse" => PMC 'Calc;Grammar' => "3+4" @ 0 { ...