Parrot Perl6Grammar compiler and parsers #19

Add an action method for TOP

regex TOP     { <integer> <addop> <integer> {*} }
regex integer { \d+ {*} }
regex addop   { [ '+' | '-' ] {*} }

method TOP($/)     {  say("found an expression ", $/); }
method integer($/) {  say("found an integer ", $/); }
method addop($/)   {  say("found an addop ", $/); }
continued...
Copyright © 2009
http://www.pmichaud.com/2009/pres/