Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat qqq
- use QRegex;
- sub compile_qast($qast) {
- my $post := QAST::Compiler.as_post($qast);
- my $pir := QAST::Compiler.pir($post);
- QAST::Compiler.evalpmc($pir);
- }
- sub compile($qast) {
- my $code := compile_qast($qast);
- $code();
- }
- compile(
- QAST::Block.new(
- QAST::Op.new(
- :op('bind'),
- QAST::Var.new( :name('$i'), :scope('lexical'), :decl('var') ),
- QAST::IVal.new( :value(5) )
- ),
- QAST::Op.new(
- :op('while'),
- QAST::Var.new( :name('$i'), :scope('lexical') ),
- QAST::Op.new(
- :op('bind'),
- QAST::Var.new( :name('$i'), :scope('lexical') ),
- QAST::Op.new(
- :op('sub_i'),
- QAST::Var.new( :name('$i'), :scope('lexical') ),
- QAST::IVal.new( :value(1) )
- )
- ),
- ),
- QAST::Var.new( :name('$i'), :scope('lexical') ),
- ),
- );
- $ ./nqp qqq
- Coercion from 'i' to 'p' NYI
- current instr.: 'nqp;QAST;Compiler;coerce' pc 39282 (src/stage2/QRegex.pir:14760) (src/stage2/QRegex.nqp:1158)
- called from Sub 'nqp;QAST;Compiler;_block2291' pc 38053 (src/stage2/QRegex.pir:14217) (src/stage2/QRegex.nqp:1043)
- called from Sub 'nqp;QAST;Compiler;_block2286' pc 37947 (src/stage2/QRegex.pir:14171) (src/stage2/QRegex.nqp:1042)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 36378 (src/stage2/QRegex.pir:13554) (src/stage2/QRegex.nqp:1040)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
- called from Sub '_block1891' pc 27737 (src/stage2/QRegex.pir:9638) (src/stage2/QRegex.nqp:386)
- called from Sub 'nqp;QAST;Operations;_block1768' pc 24484 (src/stage2/QRegex.pir:8213) (src/stage2/QRegex.nqp:171)
- called from Sub 'nqp;QAST;Operations;compile_op' pc 24345 (src/stage2/QRegex.pir:8135) (src/stage2/QRegex.nqp:171)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 35736 (src/stage2/QRegex.pir:13263) (src/stage2/QRegex.nqp:984)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
- called from Sub 'nqp;QAST;Compiler;_block2253' pc 35656 (src/stage2/QRegex.pir:13225) (src/stage2/QRegex.nqp:974)
- called from Sub 'nqp;QAST;Compiler;compile_all_the_stmts' pc 35548 (src/stage2/QRegex.pir:13170) (src/stage2/QRegex.nqp:974)
- called from Sub 'nqp;QAST;Compiler;_block2178' pc 33894 (src/stage2/QRegex.pir:12471) (src/stage2/QRegex.nqp:868)
- called from Sub 'nqp;QAST;Compiler;_block2158' pc 33149 (src/stage2/QRegex.pir:12176) (src/stage2/QRegex.nqp:866)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 32790 (src/stage2/QRegex.pir:12015) (src/stage2/QRegex.nqp:856)
- called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
- called from Sub 'compile_qast' pc 574 ((file unknown):201) (qqq:4)
- called from Sub 'compile' pc 679 ((file unknown):245) (qqq:9)
- called from Sub '_block1000' pc 387 ((file unknown):129) (qqq:15)
- called from Sub 'nqp;HLL;Compiler;_block1775' pc 32432 (src/stage2/gen/NQPHLL.pir:12075) (src/stage2/gen/NQPHLL.pm:1269)
- called from Sub 'nqp;HLL;Compiler;eval' pc 32243 (src/stage2/gen/NQPHLL.pir:11981) (src/stage2/gen/NQPHLL.pm:1259)
- called from Sub 'nqp;HLL;Compiler;evalfiles' pc 35359 (src/stage2/gen/NQPHLL.pir:13518) (src/stage2/gen/NQPHLL.pm:1457)
- called from Sub 'nqp;HLL;Compiler;_block1868' pc 34069 (src/stage2/gen/NQPHLL.pir:12887) (src/stage2/gen/NQPHLL.pm:1387)
- called from Sub 'nqp;HLL;Compiler;command_eval' pc 33637 (src/stage2/gen/NQPHLL.pir:12701) (src/stage2/gen/NQPHLL.pm:1402)
- called from Sub 'nqp;HLL;Compiler;command_line' pc 33259 (src/stage2/gen/NQPHLL.pir:12525) (src/stage2/gen/NQPHLL.pm:1353)
- called from Sub 'MAIN' pc 15047 (src/stage2/gen/NQP.pir:4833) (src/stage2/gen/NQP.pm:2935)
- called from Sub '_block1000' pc 201 (src/stage2/gen/NQP.pir:106) (src/stage2/gen/NQP.pm:1)
Add Comment
Please, Sign In to add comment