Action methods in action!
Parse rule (grammar.pg):
rule while_statement { 'while' <EXPR> <pblock> {*} }
Action method (actions.pm):
method while_statement($/) { my $cond := $( $<EXPR> ); my $block := $( $<pblock> ); $block.blocktype('immediate'); make PAST::Op.new( $cond, $block, :pasttype('while') ); }
For more details, see Parrot Compiler Toolkit talk @ 12:50