Skip to content

Instantly share code, notes, and snippets.

Created August 15, 2010 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/525830 to your computer and use it in GitHub Desktop.
Save anonymous/525830 to your computer and use it in GitHub Desktop.
pmichaud@plum:~/parrot/trunk$ cat y.pir
.namespace []
.sub "_block11" :anon :subid("10_1281896241.29539")
.annotate 'line', 1
$P0 = find_dynamic_lex "$*CTXSAVE"
if null $P0 goto ctxsave_done
$I0 = can $P0, "ctxsave"
unless $I0 goto ctxsave_done
$P0."ctxsave"()
ctxsave_done:
say "Hello"
.return ()
.const 'Sub' $P14 = "11_1281896241.29539"
.return ($P14)
.end
.namespace []
.sub "_block13" :load :anon :subid("11_1281896241.29539")
.annotate 'line', 1
.const 'Sub' $P15 = "10_1281896241.29539"
$P16 = $P15()
.return ($P16)
.end
pmichaud@plum:~/parrot/trunk$ cat z.nqp
my $pir := Q:PIR {
$P0 = new ['FileHandle']
$P0.'open'('y.pir')
%r = $P0.'readall'()
$P0.'close'()
};
my $compiler := pir::compreg__Ps('PIR');
my $pbc := $compiler($pir);
pir::print(~$pbc);
pmichaud@plum:~/parrot/trunk$ ./parrot-nqp z.nqp >z.pbc
pmichaud@plum:~/parrot/trunk$ ./parrot z.pbc
FIXUP_EVAL_2: Size in directory 14 doesn't match size 0 at offset 0x56
CONSTANT_EVAL_2: Size in directory 136 doesn't match size 0 at offset 0x64
BYTECODE_EVAL_2_DB: Size in directory 30 doesn't match size 0 at offset 0xec
PackFile_unpack segment 'FIXUP_EVAL_2' directory length 0 length in file 0 needed 8 for unpack
Constant_unpack: Unrecognized type '$' during unpack!
Segmentation fault
pmichaud@plum:~/parrot/trunk$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment