Subrule matches
Grammar:
regex TOP { <integer> <addop> <integer> {*} } regex integer { \d+ {*} } regex addop { [ '+' | '-' ] {*} }
Action method:
method TOP($/) { my $left := +($<integer>[0]); my $right := +($<integer>[1]); my $value := $<addop> eq '+' ?? $left + $right !! $left - $right; say($value); }continued...