Perl 6 Compiler Perl 6 Compiler Status and the Parrot Compiler Toolkit #33

Transforming parse to PAST

transform past (Perl6::Grammar::statement_list) :language('PIR') {
    .local pmc past
    .local pmc iter

    past = new 'Perl6::PAST::Stmts'
    past.'init'('node'=>node)

    $P0 = node['statement']
    iter = new .Iterator, $P0
  iter_loop:
    unless iter goto iter_end
    $P1 = shift iter
    $P2 = tree.'get'('past', $P1, 'Perl6::Grammar::statement')
    if null $P2 goto iter_loop
    past.'add_child'($P2)
    goto iter_loop
  iter_end:
    .return (past)
}
Copyright © 2006 Patrick Michaud