Skip to content

Commit

Permalink
Enable --target=pir to produce PIR code that can be run directly
Browse files Browse the repository at this point in the history
from Parrot (provided Rakudo has been installed).
  • Loading branch information
pmichaud committed Aug 3, 2010
1 parent 0a8ef0f commit 51cc37e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Perl6/Actions.pm
Expand Up @@ -77,9 +77,12 @@ method comp_unit($/, $key?) {
));

$unit.loadinit.unshift(
PAST::Op.new(
:name('!UNIT_OUTER'),
PAST::Var.new( :name('block'), :scope('register') )
PAST::Op.new( :pasttype<inline>,
:inline(' $P0 = find_name "!UNIT_OUTER"',
' unless null $P0 goto have_perl6',
' load_language "perl6"',
' have_perl6:',
' "!UNIT_OUTER"(block)')
)
);

Expand Down
11 changes: 11 additions & 0 deletions src/Perl6/Compiler.pir
Expand Up @@ -230,6 +230,17 @@ Perl6::Compiler - Perl6 compiler
exit 0
.end


.sub 'pir' :method
.param pmc source
.param pmc adverbs :slurpy :named
$P0 = compreg 'POST'
$S0 = $P0.'to_pir'(source, adverbs :flat :named)
$S0 = concat ".loadlib 'perl6_ops'\n", $S0
.return ($S0)
.end


.sub 'version' :method
.local pmc interp, config, rev, version
interp = getinterp
Expand Down

0 comments on commit 51cc37e

Please sign in to comment.