# Copyright (C) 2007, The Perl Foundation. # $Id: actions.pm 23964 2007-12-16 11:20:28Z bernhard $ class PIR::Grammar::Actions; ## rule TOP { } ## method TOP($/) { make $( $ ); } method program($/) { my $program := PAST::Block.new( :blocktype('declaration'), :node($/) ); my @compunits := $; for @compunits { $program.push( $($_) ); } make $program; } method compilation_unit($/, $key) { make $( $/{$key} ); } method sub_def($/) { my $sub := PAST::Block.new( :blocktype('declaration'), :node($/) ); my $subname := $($); $sub.name($subname); if $ { my @params := $; for @params { $sub.push( $($_) ); } } if $ { my @instructions := $; my $statements := PAST::Stmts.new( :node($/) ); for @instructions { $statements.push( $($_) ); } $sub.push($statements); } make $sub; } method labeled_pir_instr($/) { my $instr; if $ { $instr := $($); } if $