Parrot Parrot Compiler Toolkit #41

Example: if_stmt (cont'd)

rule if_stmt { 'if' <expression> 'then' <statement> {*} }

...

method if_stmt($/) {
    my $past := PAST::Op.new( $<expression>.ast,
                              $<statement>.ast,
                              :pasttype('if') );
    make $past;
}

"make $past" sets the AST representation (.ast) for the <if_stmt> node just parsed

The .ast for $<expression> and $<statement> were set by "make" statements in their action methods

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