daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ cat qqq
  2. use QRegex;
  3.  
  4. sub compile_qast($qast) {
  5.     my $post := QAST::Compiler.as_post($qast);
  6.     my $pir := QAST::Compiler.pir($post);
  7.     QAST::Compiler.evalpmc($pir);
  8. }
  9.  
  10. sub compile($qast) {
  11.     my $code := compile_qast($qast);
  12.     $code();
  13. }
  14.  
  15. compile(
  16.     QAST::Block.new(
  17.         QAST::Op.new(
  18.             :op('bind'),
  19.             QAST::Var.new( :name('$i'), :scope('lexical'), :decl('var') ),
  20.             QAST::IVal.new( :value(5) )
  21.         ),
  22.         QAST::Op.new(
  23.             :op('while'),
  24.             QAST::Var.new( :name('$i'), :scope('lexical') ),
  25.             QAST::Op.new(
  26.                 :op('bind'),
  27.                 QAST::Var.new( :name('$i'), :scope('lexical') ),
  28.                 QAST::Op.new(
  29.                     :op('sub_i'),
  30.                     QAST::Var.new( :name('$i'), :scope('lexical') ),
  31.                     QAST::IVal.new( :value(1) )
  32.                 )
  33.             ),
  34.         ),
  35.         QAST::Var.new( :name('$i'), :scope('lexical') ),
  36.     ),
  37. );
  38.  
  39. $ ./nqp qqq
  40. Coercion from 'i' to 'p' NYI
  41. current instr.: 'nqp;QAST;Compiler;coerce' pc 39282 (src/stage2/QRegex.pir:14760) (src/stage2/QRegex.nqp:1158)
  42. called from Sub 'nqp;QAST;Compiler;_block2291' pc 38053 (src/stage2/QRegex.pir:14217) (src/stage2/QRegex.nqp:1043)
  43. called from Sub 'nqp;QAST;Compiler;_block2286' pc 37947 (src/stage2/QRegex.pir:14171) (src/stage2/QRegex.nqp:1042)
  44. called from Sub 'nqp;QAST;Compiler;as_post' pc 36378 (src/stage2/QRegex.pir:13554) (src/stage2/QRegex.nqp:1040)
  45. called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
  46. called from Sub '_block1891' pc 27737 (src/stage2/QRegex.pir:9638) (src/stage2/QRegex.nqp:386)
  47. called from Sub 'nqp;QAST;Operations;_block1768' pc 24484 (src/stage2/QRegex.pir:8213) (src/stage2/QRegex.nqp:171)
  48. called from Sub 'nqp;QAST;Operations;compile_op' pc 24345 (src/stage2/QRegex.pir:8135) (src/stage2/QRegex.nqp:171)
  49. called from Sub 'nqp;QAST;Compiler;as_post' pc 35736 (src/stage2/QRegex.pir:13263) (src/stage2/QRegex.nqp:984)
  50. called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
  51. called from Sub 'nqp;QAST;Compiler;_block2253' pc 35656 (src/stage2/QRegex.pir:13225) (src/stage2/QRegex.nqp:974)
  52. called from Sub 'nqp;QAST;Compiler;compile_all_the_stmts' pc 35548 (src/stage2/QRegex.pir:13170) (src/stage2/QRegex.nqp:974)
  53. called from Sub 'nqp;QAST;Compiler;_block2178' pc 33894 (src/stage2/QRegex.pir:12471) (src/stage2/QRegex.nqp:868)
  54. called from Sub 'nqp;QAST;Compiler;_block2158' pc 33149 (src/stage2/QRegex.pir:12176) (src/stage2/QRegex.nqp:866)
  55. called from Sub 'nqp;QAST;Compiler;as_post' pc 32790 (src/stage2/QRegex.pir:12015) (src/stage2/QRegex.nqp:856)
  56. called from Sub 'nqp;QAST;Compiler;as_post' pc 32721 (src/stage2/QRegex.pir:11972) (src/stage2/QRegex.nqp:849)
  57. called from Sub 'compile_qast' pc 574 ((file unknown):201) (qqq:4)
  58. called from Sub 'compile' pc 679 ((file unknown):245) (qqq:9)
  59. called from Sub '_block1000' pc 387 ((file unknown):129) (qqq:15)
  60. called from Sub 'nqp;HLL;Compiler;_block1775' pc 32432 (src/stage2/gen/NQPHLL.pir:12075) (src/stage2/gen/NQPHLL.pm:1269)
  61. called from Sub 'nqp;HLL;Compiler;eval' pc 32243 (src/stage2/gen/NQPHLL.pir:11981) (src/stage2/gen/NQPHLL.pm:1259)
  62. called from Sub 'nqp;HLL;Compiler;evalfiles' pc 35359 (src/stage2/gen/NQPHLL.pir:13518) (src/stage2/gen/NQPHLL.pm:1457)
  63. called from Sub 'nqp;HLL;Compiler;_block1868' pc 34069 (src/stage2/gen/NQPHLL.pir:12887) (src/stage2/gen/NQPHLL.pm:1387)
  64. called from Sub 'nqp;HLL;Compiler;command_eval' pc 33637 (src/stage2/gen/NQPHLL.pir:12701) (src/stage2/gen/NQPHLL.pm:1402)
  65. called from Sub 'nqp;HLL;Compiler;command_line' pc 33259 (src/stage2/gen/NQPHLL.pir:12525) (src/stage2/gen/NQPHLL.pm:1353)
  66. called from Sub 'MAIN' pc 15047 (src/stage2/gen/NQP.pir:4833) (src/stage2/gen/NQP.pm:2935)
  67. called from Sub '_block1000' pc 201 (src/stage2/gen/NQP.pir:106) (src/stage2/gen/NQP.pm:1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top