Parrot Perl6Grammar compiler and parsers #13

Embedded PIR

PGE lets us embed PIR into regexes using {{..}}:

regex integer { \d+
    {{ print "found an integer "
       say match
    }}
}

regex addop { [ '+' | '-' ]
    {{ print "found an addop "
       say match
    }}
}

The inline PIR is executed at the point where it's encountered in the match.

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