Example AST transform (PIR-based)
transform while (Perl6::Grammar::statement_control) {
.local pmc exprnode, exprpast
.local pmc blocknode, blockpast
## get AST for <expression>
exprnode = node['expression']
exprpast = tree.'get'('past', exprnode,
'Perl6::Grammar::expression')
## get AST for <block>
blocknode = node['block']
blockpast = tree.'get'('past', blocknode,
'Perl6::Grammar::block')
## build while loop
.local pmc past
past = new 'PAST::Op'
past.'init'(exprpast, blockpast,
'node'=>node, 'pasttype'=>'while')
.return (past)
}