Parrot Perl6Grammar compiler and parsers #18

Action methods

class Calc::Grammar::Actions;
method integer($/) {  say("found an integer", $/); }
method addop($/)   {  say("found an addop", $/); }

In Perl 6, $/ is the standard variable for storing the results of a regex match.

The results of a regex match is a Match object.

The boolean value of a Match object is true if the regex succeeded

The string value of a Match object is the text that was matched

Copyright © 2009
http://www.pmichaud.com/2009/pres/