Commits

gabriele renzi  committed fbd009a

support tap, introduece test suite

  • Participants
  • Parent commits 27d223c

Comments (0)

Files changed (19)

File src/builtins/say.pir

 .end
 
 .namespace []
+.sub 'tap'
+    .param int val
+    print "ok "
+    print val
+    print "\n"
+    .return ()
+.end
+.sub 'plan'
+    .param int val
+    print "1.."
+    print val
+    print "\n"
+    .return ()
+.end
+
+.namespace []
 .sub 'min'
-    print "min\n"
-    .return ()
+    .param int a
+    .param int b
+    .local int c
+    c = a-b
+    .return (c)
 .end
 .namespace []
 .sub 'dup'
-    print "dup\n"
-    .return ()
+    .param int b
+    .local int c
+    c = 2*b
+    .return (c)
 .end
 .namespace []
 .sub 'add'
-    print "add\n"
-    .return ()
+    .param int a
+    .param int b
+    .local int c
+    c = a+b
+    .return (c)
 .end
 .namespace []
 .sub 'better'

File src/gen_actions.pir

 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "_block13" :init :load :subid("32")
-    .const 'Sub' $P298 = "30" 
-    capture_lex $P298
-    .const 'Sub' $P281 = "29" 
-    capture_lex $P281
-    .const 'Sub' $P269 = "28" 
-    capture_lex $P269
+.sub "_block13" :init :load :subid("34")
+    .const 'Sub' $P328 = "32" 
+    capture_lex $P328
+    .const 'Sub' $P311 = "31" 
+    capture_lex $P311
+    .const 'Sub' $P299 = "30" 
+    capture_lex $P299
+    .const 'Sub' $P280 = "29" 
+    capture_lex $P280
+    .const 'Sub' $P265 = "28" 
+    capture_lex $P265
     .const 'Sub' $P250 = "27" 
     capture_lex $P250
     .const 'Sub' $P225 = "25" 
         $P2 = $P0.'new_class'($P1)
       subclass_done:
         pop_eh
-    .const 'Sub' $P298 = "30" 
-    capture_lex $P298
-    .return ($P298)
+    .const 'Sub' $P328 = "32" 
+    capture_lex $P328
+    .return ($P328)
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "TOP"  :subid("11") :method :outer("32")
+.sub "TOP"  :subid("11") :method :outer("34")
     .param pmc param_18
     new $P17, 'ExceptionHandler'
     set_addr $P17, control_16
     .lex "$/", param_18
     get_hll_global $P19, ["PAST"], "Block"
     find_lex $P20, "$/"
-    unless_null $P20, vivify_33
+    unless_null $P20, vivify_35
     new $P20, "Undef"
-  vivify_33:
+  vivify_35:
     $P21 = $P19."new"($P20 :named("node"))
     .lex "$past", $P21
     get_hll_global $P22, ["PAST"], "Var"
     find_lex $P23, "$/"
-    unless_null $P23, vivify_34
+    unless_null $P23, vivify_36
     new $P23, "Undef"
-  vivify_34:
+  vivify_36:
     $P24 = $P22."new"("the_condition" :named("name"), 1 :named("isdecl"), "package" :named("scope"), $P23 :named("node"))
     .lex "$tc", $P24
     find_lex $P25, "$past"
-    unless_null $P25, vivify_35
+    unless_null $P25, vivify_37
     new $P25, "Undef"
-  vivify_35:
+  vivify_37:
     find_lex $P26, "$tc"
-    unless_null $P26, vivify_36
+    unless_null $P26, vivify_38
     new $P26, "Undef"
-  vivify_36:
+  vivify_38:
     $P25."push"($P26)
     find_lex $P28, "$/"
     set $P29, $P28["scene"]
-    unless_null $P29, vivify_37
+    unless_null $P29, vivify_39
     new $P29, "Undef"
-  vivify_37:
+  vivify_39:
     defined $I30, $P29
-    unless $I30, for_undef_38
+    unless $I30, for_undef_40
     iter $P27, $P29
     new $P40, 'ExceptionHandler'
     set_addr $P40, loop39_handler
     eq $P41, 66, loop39_redo
   loop39_done:
     pop_eh 
-  for_undef_38:
+  for_undef_40:
     find_lex $P42, "$/"
     find_lex $P43, "$past"
-    unless_null $P43, vivify_41
+    unless_null $P43, vivify_43
     new $P43, "Undef"
-  vivify_41:
+  vivify_43:
     $P44 = $P42."result_object"($P43)
     .return ($P44)
   control_16:
     .param pmc param_34
     .lex "$_", param_34
     find_lex $P35, "$past"
-    unless_null $P35, vivify_39
+    unless_null $P35, vivify_41
     new $P35, "Undef"
-  vivify_39:
+  vivify_41:
     find_lex $P36, "$_"
-    unless_null $P36, vivify_40
+    unless_null $P36, vivify_42
     new $P36, "Undef"
-  vivify_40:
+  vivify_42:
     $P37 = $P36."item"()
     $P38 = $P35."push"($P37)
     .return ($P38)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "scene"  :subid("13") :method :outer("32")
+.sub "scene"  :subid("13") :method :outer("34")
     .param pmc param_49
     new $P48, 'ExceptionHandler'
     set_addr $P48, control_47
     get_hll_global $P50, ["PAST"], "Stmts"
     find_lex $P51, "$/"
     set $P52, $P51["roman"]
-    unless_null $P52, vivify_42
+    unless_null $P52, vivify_44
     new $P52, "Undef"
-  vivify_42:
+  vivify_44:
     find_lex $P53, "$/"
-    unless_null $P53, vivify_43
+    unless_null $P53, vivify_45
     new $P53, "Undef"
-  vivify_43:
+  vivify_45:
     $P54 = $P50."new"($P52 :named("name"), $P53 :named("node"))
     .lex "$past", $P54
     get_hll_global $P55, ["PAST"], "Op"
     assign $P56, ""
     find_lex $P57, "$/"
     set $P58, $P57["roman"]
-    unless_null $P58, vivify_44
+    unless_null $P58, vivify_46
     new $P58, "Undef"
-  vivify_44:
+  vivify_46:
     concat $P59, $P56, $P58
     concat $P60, $P59, ":"
     find_lex $P61, "$/"
-    unless_null $P61, vivify_45
+    unless_null $P61, vivify_47
     new $P61, "Undef"
-  vivify_45:
+  vivify_47:
     $P62 = $P55."new"($P60 :named("inline"), $P61 :named("node"))
     .lex "$lbl", $P62
     find_lex $P63, "$past"
-    unless_null $P63, vivify_46
+    unless_null $P63, vivify_48
     new $P63, "Undef"
-  vivify_46:
+  vivify_48:
     find_lex $P64, "$lbl"
-    unless_null $P64, vivify_47
+    unless_null $P64, vivify_49
     new $P64, "Undef"
-  vivify_47:
+  vivify_49:
     $P63."push"($P64)
     find_lex $P66, "$/"
     set $P67, $P66["line"]
-    unless_null $P67, vivify_48
+    unless_null $P67, vivify_50
     new $P67, "Undef"
-  vivify_48:
+  vivify_50:
     defined $I68, $P67
-    unless $I68, for_undef_49
+    unless $I68, for_undef_51
     iter $P65, $P67
     new $P78, 'ExceptionHandler'
     set_addr $P78, loop77_handler
     eq $P79, 66, loop77_redo
   loop77_done:
     pop_eh 
-  for_undef_49:
+  for_undef_51:
     find_lex $P80, "$/"
     find_lex $P81, "$past"
-    unless_null $P81, vivify_52
+    unless_null $P81, vivify_54
     new $P81, "Undef"
-  vivify_52:
+  vivify_54:
     $P82 = $P80."result_object"($P81)
     .return ($P82)
   control_47:
     .param pmc param_72
     .lex "$_", param_72
     find_lex $P73, "$past"
-    unless_null $P73, vivify_50
+    unless_null $P73, vivify_52
     new $P73, "Undef"
-  vivify_50:
+  vivify_52:
     find_lex $P74, "$_"
-    unless_null $P74, vivify_51
+    unless_null $P74, vivify_53
     new $P74, "Undef"
-  vivify_51:
+  vivify_53:
     $P75 = $P74."item"()
     $P76 = $P73."push"($P75)
     .return ($P76)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "branch"  :subid("15") :method :outer("32")
+.sub "branch"  :subid("15") :method :outer("34")
     .param pmc param_87
     new $P86, 'ExceptionHandler'
     set_addr $P86, control_85
     assign $P88, "branch:"
     find_lex $P89, "$/"
     set $P90, $P89["roman"]
-    unless_null $P90, vivify_53
+    unless_null $P90, vivify_55
     new $P90, "Undef"
-  vivify_53:
+  vivify_55:
     concat $P91, $P88, $P90
     "dbg"($P91)
     get_hll_global $P92, ["PAST"], "Op"
     assign $P93, "goto "
     find_lex $P94, "$/"
     set $P95, $P94["roman"]
-    unless_null $P95, vivify_54
+    unless_null $P95, vivify_56
     new $P95, "Undef"
-  vivify_54:
+  vivify_56:
     concat $P96, $P93, $P95
     find_lex $P97, "$/"
-    unless_null $P97, vivify_55
+    unless_null $P97, vivify_57
     new $P97, "Undef"
-  vivify_55:
+  vivify_57:
     $P98 = $P92."new"($P96 :named("inline"), $P97 :named("node"))
     .lex "$res", $P98
     find_lex $P99, "$/"
     find_lex $P100, "$res"
-    unless_null $P100, vivify_56
+    unless_null $P100, vivify_58
     new $P100, "Undef"
-  vivify_56:
+  vivify_58:
     $P101 = $P99."result_object"($P100)
     .return ($P101)
   control_85:
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "io"  :subid("16") :method :outer("32")
+.sub "io"  :subid("16") :method :outer("34")
     .param pmc param_106
     .param pmc param_107
     new $P105, 'ExceptionHandler'
     new $P108, "String"
     assign $P108, "io:"
     find_lex $P109, "$key"
-    unless_null $P109, vivify_57
+    unless_null $P109, vivify_59
     new $P109, "Undef"
-  vivify_57:
+  vivify_59:
     concat $P110, $P108, $P109
     "dbg"($P110)
     get_hll_global $P111, ["PAST"], "Op"
     find_lex $P112, "$/"
-    unless_null $P112, vivify_58
+    unless_null $P112, vivify_60
     new $P112, "Undef"
-  vivify_58:
+  vivify_60:
     $P113 = $P111."new"("say2" :named("name"), "call" :named("pasttype"), $P112 :named("node"))
     .lex "$res", $P113
     "dbg"("ok")
     find_lex $P114, "$/"
     find_lex $P115, "$res"
-    unless_null $P115, vivify_59
+    unless_null $P115, vivify_61
     new $P115, "Undef"
-  vivify_59:
+  vivify_61:
     $P116 = $P114."result_object"($P115)
     .return ($P116)
   control_104:
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "line"  :subid("17") :method :outer("32")
+.sub "line"  :subid("17") :method :outer("34")
     .param pmc param_121
     new $P120, 'ExceptionHandler'
     set_addr $P120, control_119
     .lex "$/", param_121
     get_hll_global $P122, ["PAST"], "Stmts"
     find_lex $P123, "$/"
-    unless_null $P123, vivify_60
+    unless_null $P123, vivify_62
     new $P123, "Undef"
-  vivify_60:
+  vivify_62:
     $P124 = $P122."new"($P123 :named("node"))
     .lex "$past", $P124
     find_lex $P126, "$/"
     set $P127, $P126["sentence"]
-    unless_null $P127, vivify_61
+    unless_null $P127, vivify_63
     new $P127, "Undef"
-  vivify_61:
+  vivify_63:
     defined $I128, $P127
-    unless $I128, for_undef_62
+    unless $I128, for_undef_64
     iter $P125, $P127
     new $P138, 'ExceptionHandler'
     set_addr $P138, loop137_handler
     eq $P139, 66, loop137_redo
   loop137_done:
     pop_eh 
-  for_undef_62:
+  for_undef_64:
     find_lex $P140, "$/"
     find_lex $P141, "$past"
-    unless_null $P141, vivify_65
+    unless_null $P141, vivify_67
     new $P141, "Undef"
-  vivify_65:
+  vivify_67:
     $P142 = $P140."result_object"($P141)
     .return ($P142)
   control_119:
     .param pmc param_132
     .lex "$_", param_132
     find_lex $P133, "$past"
-    unless_null $P133, vivify_63
+    unless_null $P133, vivify_65
     new $P133, "Undef"
-  vivify_63:
+  vivify_65:
     find_lex $P134, "$_"
-    unless_null $P134, vivify_64
+    unless_null $P134, vivify_66
     new $P134, "Undef"
-  vivify_64:
+  vivify_66:
     $P135 = $P134."item"()
     $P136 = $P133."push"($P135)
     .return ($P136)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "sentence"  :subid("19") :method :outer("32")
+.sub "sentence"  :subid("19") :method :outer("34")
     .param pmc param_147
     .param pmc param_148
     new $P146, 'ExceptionHandler'
     new $P149, "String"
     assign $P149, "sentence:"
     find_lex $P150, "$key"
-    unless_null $P150, vivify_66
+    unless_null $P150, vivify_68
     new $P150, "Undef"
-  vivify_66:
+  vivify_68:
     concat $P151, $P149, $P150
     "dbg"($P151)
     find_lex $P152, "$/"
     find_lex $P153, "$key"
-    unless_null $P153, vivify_67
+    unless_null $P153, vivify_69
     new $P153, "Undef"
-  vivify_67:
+  vivify_69:
     find_lex $P154, "$/"
-    unless_null $P154, vivify_68
+    unless_null $P154, vivify_70
     new $P154, "Hash"
-  vivify_68:
+  vivify_70:
     set $P155, $P154[$P153]
-    unless_null $P155, vivify_69
+    unless_null $P155, vivify_71
     new $P155, "Undef"
-  vivify_69:
+  vivify_71:
     $P156 = $P155."item"()
     $P157 = $P152."result_object"($P156)
     .return ($P157)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "dbg"  :subid("20") :outer("32")
+.sub "dbg"  :subid("20") :outer("34")
     .param pmc param_162
     new $P161, 'ExceptionHandler'
     set_addr $P161, control_160
 .namespace ["z2";"Grammar";"Actions"]
 .sub "_block166"  :anon :subid("21") :outer("20")
     find_lex $P168, "$str"
-    unless_null $P168, vivify_70
+    unless_null $P168, vivify_72
     new $P168, "Undef"
-  vivify_70:
+  vivify_72:
     $P169 = "say"($P168)
     .return ($P169)
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "value"  :subid("22") :method :outer("32")
+.sub "value"  :subid("22") :method :outer("34")
     .param pmc param_175
     .param pmc param_176
     new $P174, 'ExceptionHandler'
     .lex "$key", param_176
     find_lex $P177, "$/"
     find_lex $P178, "$key"
-    unless_null $P178, vivify_71
+    unless_null $P178, vivify_73
     new $P178, "Undef"
-  vivify_71:
+  vivify_73:
     find_lex $P179, "$/"
-    unless_null $P179, vivify_72
+    unless_null $P179, vivify_74
     new $P179, "Hash"
-  vivify_72:
+  vivify_74:
     set $P180, $P179[$P178]
-    unless_null $P180, vivify_73
+    unless_null $P180, vivify_75
     new $P180, "Undef"
-  vivify_73:
+  vivify_75:
     $P181 = $P180."item"()
     $P182 = $P177."result_object"($P181)
     .return ($P182)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "question"  :subid("23") :method :outer("32")
+.sub "question"  :subid("23") :method :outer("34")
     .param pmc param_187
     .param pmc param_188
     new $P186, 'ExceptionHandler'
     assign $P189, "question:"
     find_lex $P190, "$/"
     set $P191, $P190["key"]
-    unless_null $P191, vivify_74
+    unless_null $P191, vivify_76
     new $P191, "Undef"
-  vivify_74:
+  vivify_76:
     concat $P192, $P189, $P191
     "dbg"($P192)
     get_hll_global $P193, ["PAST"], "Op"
     assign $P194, "goto "
     find_lex $P195, "$/"
     set $P196, $P195["roman"]
-    unless_null $P196, vivify_75
+    unless_null $P196, vivify_77
     new $P196, "Undef"
-  vivify_75:
+  vivify_77:
     concat $P197, $P194, $P196
     find_lex $P198, "$/"
-    unless_null $P198, vivify_76
+    unless_null $P198, vivify_78
     new $P198, "Undef"
-  vivify_76:
+  vivify_78:
     $P199 = $P193."new"($P197 :named("inline"), $P198 :named("node"))
     .lex "$res", $P199
     find_lex $P200, "$/"
     find_lex $P201, "$res"
-    unless_null $P201, vivify_77
+    unless_null $P201, vivify_79
     new $P201, "Undef"
-  vivify_77:
+  vivify_79:
     $P200."result_object"($P201)
     get_hll_global $P202, ["PAST"], "Op"
     find_lex $P203, "$key"
-    unless_null $P203, vivify_78
+    unless_null $P203, vivify_80
     new $P203, "Undef"
-  vivify_78:
+  vivify_80:
     find_lex $P204, "$/"
-    unless_null $P204, vivify_79
+    unless_null $P204, vivify_81
     new $P204, "Undef"
-  vivify_79:
+  vivify_81:
     $P205 = $P202."new"($P203 :named("name"), "call" :named("pasttype"), $P204 :named("node"))
     store_lex "$res", $P205
     find_lex $P207, "$/"
     set $P208, $P207["value"]
-    unless_null $P208, vivify_80
+    unless_null $P208, vivify_82
     new $P208, "Undef"
-  vivify_80:
+  vivify_82:
     defined $I209, $P208
-    unless $I209, for_undef_81
+    unless $I209, for_undef_83
     iter $P206, $P208
     new $P219, 'ExceptionHandler'
     set_addr $P219, loop218_handler
     eq $P220, 66, loop218_redo
   loop218_done:
     pop_eh 
-  for_undef_81:
+  for_undef_83:
     find_lex $P221, "$/"
     find_lex $P222, "$res"
-    unless_null $P222, vivify_84
+    unless_null $P222, vivify_86
     new $P222, "Undef"
-  vivify_84:
+  vivify_86:
     $P223 = $P221."result_object"($P222)
     .return ($P223)
   control_185:
     .param pmc param_213
     .lex "$_", param_213
     find_lex $P214, "$res"
-    unless_null $P214, vivify_82
+    unless_null $P214, vivify_84
     new $P214, "Undef"
-  vivify_82:
+  vivify_84:
     find_lex $P215, "$_"
-    unless_null $P215, vivify_83
+    unless_null $P215, vivify_85
     new $P215, "Undef"
-  vivify_83:
+  vivify_85:
     $P216 = $P215."item"()
     $P217 = $P214."push"($P216)
     .return ($P217)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "immediate"  :subid("25") :method :outer("32")
+.sub "immediate"  :subid("25") :method :outer("34")
     .param pmc param_228
     new $P227, 'ExceptionHandler'
     set_addr $P227, control_226
     .lex "$value", $P229
     find_lex $P231, "$/"
     set $P232, $P231["adjective"]
-    unless_null $P232, vivify_85
+    unless_null $P232, vivify_87
     new $P232, "Undef"
-  vivify_85:
+  vivify_87:
     defined $I233, $P232
-    unless $I233, for_undef_86
+    unless $I233, for_undef_88
     iter $P230, $P232
     new $P241, 'ExceptionHandler'
     set_addr $P241, loop240_handler
     eq $P242, 66, loop240_redo
   loop240_done:
     pop_eh 
-  for_undef_86:
+  for_undef_88:
     find_lex $P243, "$/"
     get_hll_global $P244, ["PAST"], "Val"
     find_lex $P245, "$value"
-    unless_null $P245, vivify_88
+    unless_null $P245, vivify_90
     new $P245, "Undef"
-  vivify_88:
+  vivify_90:
     find_lex $P246, "$/"
-    unless_null $P246, vivify_89
+    unless_null $P246, vivify_91
     new $P246, "Undef"
-  vivify_89:
+  vivify_91:
     $P247 = $P244."new"($P245 :named("value"), "Integer" :named("returns"), $P246 :named("node"))
     $P248 = $P243."result_object"($P247)
     .return ($P248)
     .param pmc param_237
     .lex "$_", param_237
     find_lex $P238, "$value"
-    unless_null $P238, vivify_87
+    unless_null $P238, vivify_89
     new $P238, "Undef"
-  vivify_87:
+  vivify_89:
     mul $P239, $P238, 2
     store_lex "$value", $P239
     .return ($P239)
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "test"  :subid("27") :method :outer("32")
+.sub "tap"  :subid("27") :method :outer("34")
     .param pmc param_253
-    .param pmc param_254
     new $P252, 'ExceptionHandler'
     set_addr $P252, control_251
     $P252."handle_types"(58)
     push_eh $P252
     .lex "$/", param_253
-    .lex "$k", param_254
-    get_hll_global $P255, ["PAST"], "Var"
-    find_lex $P256, "$/"
-    unless_null $P256, vivify_90
-    new $P256, "Undef"
-  vivify_90:
-    $P257 = $P255."new"("the_condition" :named("name"), 0 :named("isdecl"), "package" :named("scope"), $P256 :named("node"))
-    .lex "$test", $P257
+    get_hll_global $P254, ["PAST"], "Op"
+    find_lex $P255, "$/"
+    unless_null $P255, vivify_92
+    new $P255, "Undef"
+  vivify_92:
+    $P256 = $P254."new"("tap" :named("name"), "call" :named("pasttype"), $P255 :named("node"))
+    .lex "$res", $P256
+    find_lex $P257, "$res"
+    unless_null $P257, vivify_93
+    new $P257, "Undef"
+  vivify_93:
     find_lex $P258, "$/"
-    get_hll_global $P259, ["PAST"], "Op"
-    find_lex $P260, "$test"
-    unless_null $P260, vivify_91
-    new $P260, "Undef"
-  vivify_91:
+    set $P259, $P258["value"]
+    unless_null $P259, vivify_94
+    new $P259, "Undef"
+  vivify_94:
+    $P260 = $P259."item"()
+    $P257."push"($P260)
     find_lex $P261, "$/"
-    set $P262, $P261["branch"]
-    unless_null $P262, vivify_92
+    find_lex $P262, "$res"
+    unless_null $P262, vivify_95
     new $P262, "Undef"
-  vivify_92:
-    $P263 = $P262."item"()
-    find_lex $P264, "$k"
-    unless_null $P264, vivify_93
-    new $P264, "Undef"
-  vivify_93:
-    find_lex $P265, "$/"
-    unless_null $P265, vivify_94
-    new $P265, "Undef"
-  vivify_94:
-    $P266 = $P259."new"($P260, $P263, $P264 :named("pasttype"), $P265 :named("node"))
-    $P267 = $P258."result_object"($P266)
-    .return ($P267)
+  vivify_95:
+    $P263 = $P261."result_object"($P262)
+    .return ($P263)
   control_251:
     .local pmc exception 
     .get_results (exception) 
-    getattribute $P268, exception, "payload"
-    .return ($P268)
+    getattribute $P264, exception, "payload"
+    .return ($P264)
     rethrow exception
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "computation"  :subid("28") :method :outer("32")
-    .param pmc param_272
-    .param pmc param_273
-    new $P271, 'ExceptionHandler'
-    set_addr $P271, control_270
-    $P271."handle_types"(58)
-    push_eh $P271
-    .lex "$/", param_272
-    .lex "$key", param_273
-    find_lex $P274, "$/"
-    find_lex $P275, "$key"
-    unless_null $P275, vivify_95
-    new $P275, "Undef"
-  vivify_95:
+.sub "plan"  :subid("28") :method :outer("34")
+    .param pmc param_268
+    new $P267, 'ExceptionHandler'
+    set_addr $P267, control_266
+    $P267."handle_types"(58)
+    push_eh $P267
+    .lex "$/", param_268
+    get_hll_global $P269, ["PAST"], "Op"
+    find_lex $P270, "$/"
+    unless_null $P270, vivify_96
+    new $P270, "Undef"
+  vivify_96:
+    $P271 = $P269."new"("plan" :named("name"), "call" :named("pasttype"), $P270 :named("node"))
+    .lex "$res", $P271
+    find_lex $P272, "$res"
+    unless_null $P272, vivify_97
+    new $P272, "Undef"
+  vivify_97:
+    find_lex $P273, "$/"
+    set $P274, $P273["value"]
+    unless_null $P274, vivify_98
+    new $P274, "Undef"
+  vivify_98:
+    $P275 = $P274."item"()
+    $P272."push"($P275)
     find_lex $P276, "$/"
-    unless_null $P276, vivify_96
-    new $P276, "Hash"
-  vivify_96:
-    set $P277, $P276[$P275]
-    unless_null $P277, vivify_97
+    find_lex $P277, "$res"
+    unless_null $P277, vivify_99
     new $P277, "Undef"
-  vivify_97:
-    $P278 = $P277."item"()
-    $P279 = $P274."result_object"($P278)
-    .return ($P279)
-  control_270:
+  vivify_99:
+    $P278 = $P276."result_object"($P277)
+    .return ($P278)
+  control_266:
     .local pmc exception 
     .get_results (exception) 
-    getattribute $P280, exception, "payload"
-    .return ($P280)
+    getattribute $P279, exception, "payload"
+    .return ($P279)
     rethrow exception
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "unary"  :subid("29") :method :outer("32")
+.sub "test"  :subid("29") :method :outer("34")
+    .param pmc param_283
     .param pmc param_284
-    .param pmc param_285
-    new $P283, 'ExceptionHandler'
-    set_addr $P283, control_282
-    $P283."handle_types"(58)
-    push_eh $P283
-    .lex "$/", param_284
-    .lex "$key", param_285
-    get_hll_global $P286, ["PAST"], "Op"
-    find_lex $P287, "$key"
-    unless_null $P287, vivify_98
-    new $P287, "Undef"
-  vivify_98:
+    new $P282, 'ExceptionHandler'
+    set_addr $P282, control_281
+    $P282."handle_types"(58)
+    push_eh $P282
+    .lex "$/", param_283
+    .lex "$k", param_284
+    get_hll_global $P285, ["PAST"], "Var"
+    find_lex $P286, "$/"
+    unless_null $P286, vivify_100
+    new $P286, "Undef"
+  vivify_100:
+    $P287 = $P285."new"("the_condition" :named("name"), 0 :named("isdecl"), "package" :named("scope"), $P286 :named("node"))
+    .lex "$test", $P287
     find_lex $P288, "$/"
-    unless_null $P288, vivify_99
-    new $P288, "Undef"
-  vivify_99:
-    $P289 = $P286."new"($P287 :named("name"), "call" :named("pasttype"), $P288 :named("node"))
-    .lex "$res", $P289
-    find_lex $P290, "$res"
-    unless_null $P290, vivify_100
+    get_hll_global $P289, ["PAST"], "Op"
+    find_lex $P290, "$test"
+    unless_null $P290, vivify_101
     new $P290, "Undef"
-  vivify_100:
+  vivify_101:
     find_lex $P291, "$/"
-    set $P292, $P291["value"]
-    unless_null $P292, vivify_101
+    set $P292, $P291["branch"]
+    unless_null $P292, vivify_102
     new $P292, "Undef"
-  vivify_101:
+  vivify_102:
     $P293 = $P292."item"()
-    $P290."push"($P293)
-    find_lex $P294, "$/"
-    find_lex $P295, "$res"
-    unless_null $P295, vivify_102
+    find_lex $P294, "$k"
+    unless_null $P294, vivify_103
+    new $P294, "Undef"
+  vivify_103:
+    find_lex $P295, "$/"
+    unless_null $P295, vivify_104
     new $P295, "Undef"
-  vivify_102:
-    $P296 = $P294."result_object"($P295)
-    .return ($P296)
-  control_282:
+  vivify_104:
+    $P296 = $P289."new"($P290, $P293, $P294 :named("pasttype"), $P295 :named("node"))
+    $P297 = $P288."result_object"($P296)
+    .return ($P297)
+  control_281:
     .local pmc exception 
     .get_results (exception) 
-    getattribute $P297, exception, "payload"
-    .return ($P297)
+    getattribute $P298, exception, "payload"
+    .return ($P298)
     rethrow exception
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "binary"  :subid("30") :method :outer("32")
-    .param pmc param_301
+.sub "computation"  :subid("30") :method :outer("34")
     .param pmc param_302
-    new $P300, 'ExceptionHandler'
-    set_addr $P300, control_299
-    $P300."handle_types"(58)
-    push_eh $P300
-    .lex "$/", param_301
-    .lex "$key", param_302
-    get_hll_global $P303, ["PAST"], "Op"
-    find_lex $P304, "$key"
-    unless_null $P304, vivify_103
-    new $P304, "Undef"
-  vivify_103:
-    find_lex $P305, "$/"
-    unless_null $P305, vivify_104
+    .param pmc param_303
+    new $P301, 'ExceptionHandler'
+    set_addr $P301, control_300
+    $P301."handle_types"(58)
+    push_eh $P301
+    .lex "$/", param_302
+    .lex "$key", param_303
+    find_lex $P304, "$/"
+    find_lex $P305, "$key"
+    unless_null $P305, vivify_105
     new $P305, "Undef"
-  vivify_104:
-    $P306 = $P303."new"($P304 :named("name"), "call" :named("pasttype"), $P305 :named("node"))
-    .lex "$res", $P306
-    find_lex $P308, "$/"
-    set $P309, $P308["value"]
-    unless_null $P309, vivify_105
-    new $P309, "Undef"
   vivify_105:
-    defined $I310, $P309
-    unless $I310, for_undef_106
-    iter $P307, $P309
-    new $P320, 'ExceptionHandler'
-    set_addr $P320, loop319_handler
-    $P320."handle_types"(64, 66, 65)
-    push_eh $P320
-  loop319_test:
-    unless $P307, loop319_done
-    shift $P311, $P307
-  loop319_redo:
-    .const 'Sub' $P313 = "31" 
-    capture_lex $P313
-    $P313($P311)
-  loop319_next:
-    goto loop319_test
-  loop319_handler:
+    find_lex $P306, "$/"
+    unless_null $P306, vivify_106
+    new $P306, "Hash"
+  vivify_106:
+    set $P307, $P306[$P305]
+    unless_null $P307, vivify_107
+    new $P307, "Undef"
+  vivify_107:
+    $P308 = $P307."item"()
+    $P309 = $P304."result_object"($P308)
+    .return ($P309)
+  control_300:
     .local pmc exception 
     .get_results (exception) 
-    getattribute $P321, exception, 'type'
-    eq $P321, 64, loop319_next
-    eq $P321, 66, loop319_redo
-  loop319_done:
-    pop_eh 
-  for_undef_106:
-    find_lex $P322, "$/"
-    find_lex $P323, "$res"
-    unless_null $P323, vivify_109
-    new $P323, "Undef"
-  vivify_109:
-    $P324 = $P322."result_object"($P323)
-    .return ($P324)
-  control_299:
-    .local pmc exception 
-    .get_results (exception) 
-    getattribute $P325, exception, "payload"
-    .return ($P325)
+    getattribute $P310, exception, "payload"
+    .return ($P310)
     rethrow exception
 .end
 
 
 .namespace ["z2";"Grammar";"Actions"]
-.sub "_block312"  :anon :subid("31") :outer("30")
+.sub "unary"  :subid("31") :method :outer("34")
     .param pmc param_314
-    .lex "$_", param_314
-    find_lex $P315, "$res"
-    unless_null $P315, vivify_107
-    new $P315, "Undef"
-  vivify_107:
-    find_lex $P316, "$_"
-    unless_null $P316, vivify_108
-    new $P316, "Undef"
+    .param pmc param_315
+    new $P313, 'ExceptionHandler'
+    set_addr $P313, control_312
+    $P313."handle_types"(58)
+    push_eh $P313
+    .lex "$/", param_314
+    .lex "$key", param_315
+    get_hll_global $P316, ["PAST"], "Op"
+    find_lex $P317, "$key"
+    unless_null $P317, vivify_108
+    new $P317, "Undef"
   vivify_108:
-    $P317 = $P316."item"()
-    $P318 = $P315."push"($P317)
-    .return ($P318)
+    find_lex $P318, "$/"
+    unless_null $P318, vivify_109
+    new $P318, "Undef"
+  vivify_109:
+    $P319 = $P316."new"($P317 :named("name"), "call" :named("pasttype"), $P318 :named("node"))
+    .lex "$res", $P319
+    find_lex $P320, "$res"
+    unless_null $P320, vivify_110
+    new $P320, "Undef"
+  vivify_110:
+    find_lex $P321, "$/"
+    set $P322, $P321["value"]
+    unless_null $P322, vivify_111
+    new $P322, "Undef"
+  vivify_111:
+    $P323 = $P322."item"()
+    $P320."push"($P323)
+    find_lex $P324, "$/"
+    find_lex $P325, "$res"
+    unless_null $P325, vivify_112
+    new $P325, "Undef"
+  vivify_112:
+    $P326 = $P324."result_object"($P325)
+    .return ($P326)
+  control_312:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P327, exception, "payload"
+    .return ($P327)
+    rethrow exception
 .end
 
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "binary"  :subid("32") :method :outer("34")
+    .param pmc param_331
+    .param pmc param_332
+    new $P330, 'ExceptionHandler'
+    set_addr $P330, control_329
+    $P330."handle_types"(58)
+    push_eh $P330
+    .lex "$/", param_331
+    .lex "$key", param_332
+    get_hll_global $P333, ["PAST"], "Op"
+    find_lex $P334, "$key"
+    unless_null $P334, vivify_113
+    new $P334, "Undef"
+  vivify_113:
+    find_lex $P335, "$/"
+    unless_null $P335, vivify_114
+    new $P335, "Undef"
+  vivify_114:
+    $P336 = $P333."new"($P334 :named("name"), "call" :named("pasttype"), $P335 :named("node"))
+    .lex "$res", $P336
+    find_lex $P338, "$/"
+    set $P339, $P338["value"]
+    unless_null $P339, vivify_115
+    new $P339, "Undef"
+  vivify_115:
+    defined $I340, $P339
+    unless $I340, for_undef_116
+    iter $P337, $P339
+    new $P350, 'ExceptionHandler'
+    set_addr $P350, loop349_handler
+    $P350."handle_types"(64, 66, 65)
+    push_eh $P350
+  loop349_test:
+    unless $P337, loop349_done
+    shift $P341, $P337
+  loop349_redo:
+    .const 'Sub' $P343 = "33" 
+    capture_lex $P343
+    $P343($P341)
+  loop349_next:
+    goto loop349_test
+  loop349_handler:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P351, exception, 'type'
+    eq $P351, 64, loop349_next
+    eq $P351, 66, loop349_redo
+  loop349_done:
+    pop_eh 
+  for_undef_116:
+    find_lex $P352, "$/"
+    find_lex $P353, "$res"
+    unless_null $P353, vivify_119
+    new $P353, "Undef"
+  vivify_119:
+    $P354 = $P352."result_object"($P353)
+    .return ($P354)
+  control_329:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P355, exception, "payload"
+    .return ($P355)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "_block342"  :anon :subid("33") :outer("32")
+    .param pmc param_344
+    .lex "$_", param_344
+    find_lex $P345, "$res"
+    unless_null $P345, vivify_117
+    new $P345, "Undef"
+  vivify_117:
+    find_lex $P346, "$_"
+    unless_null $P346, vivify_118
+    new $P346, "Undef"
+  vivify_118:
+    $P347 = $P346."item"()
+    $P348 = $P345."push"($P347)
+    .return ($P348)
+.end
+

File src/gen_builtins.pir

 .end
 
 .namespace []
+.sub 'tap'
+    .param int val
+    print "ok "
+    print val
+    print "\n"
+    .return ()
+.end
+.sub 'plan'
+    .param int val
+    print "1.."
+    print val
+    print "\n"
+    .return ()
+.end
+
+.namespace []
 .sub 'min'
-    print "min\n"
-    .return ()
+    .param int a
+    .param int b
+    .local int c
+    c = a-b
+    .return (c)
 .end
 .namespace []
 .sub 'dup'
-    print "dup\n"
-    .return ()
+    .param int b
+    .local int c
+    c = 2*b
+    .return (c)
 .end
 .namespace []
 .sub 'add'
-    print "add\n"
-    .return ()
+    .param int a
+    .param int b
+    .local int c
+    c = a+b
+    .return (c)
 .end
 .namespace []
 .sub 'better'