Commits

gabriele renzi  committed 04e8bf0

first commit, pir gen for values is ok

  • Participants

Comments (0)

Files changed (17)

File .t.z.swp

Binary file added.
+# ex: set ro ft=make:
+# DO NOT EDIT THIS FILE
+# Generated by Parrot::Configure::Compiler from languages/z2/config/makefiles/root.in
+
+## $Id$
+
+## arguments we want to run parrot with
+PARROT_ARGS =
+
+## configuration settings
+BUILD_DIR     = /home/rff/parrot
+LOAD_EXT      = .so
+O             = .o
+
+## Setup some commands
+LN_S          = /bin/ln -s
+PERL          = /usr/bin/perl
+RM_RF         = $(PERL) -MExtUtils::Command -e rm_rf
+CP            = $(PERL) -MExtUtils::Command -e cp
+PARROT        = ../../parrot
+CAT           = $(PERL) -MExtUtils::Command -e cat
+BUILD_DYNPMC  = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
+RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
+
+## places to look for things
+PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
+PGE_LIBRARY   = $(BUILD_DIR)/runtime/parrot/library/PGE
+PERL6GRAMMAR  = $(PGE_LIBRARY)/Perl6Grammar.pbc
+NQP           = $(BUILD_DIR)/compilers/nqp/nqp.pbc
+PCT           = $(BUILD_DIR)/runtime/parrot/library/PCT.pbc
+
+PMC_DIR       = src/pmc
+
+all: z2.pbc
+
+Z2_GROUP = $(PMC_DIR)/z2_group$(LOAD_EXT)
+
+SOURCES = z2.pir \
+  src/gen_grammar.pir \
+  src/gen_actions.pir \
+  src/gen_builtins.pir \
+#  $(Z2_GROUP)
+
+BUILTINS_PIR = \
+  src/builtins/say.pir \
+
+# PMCS = z2
+# PMC_SOURCES = $(PMC_DIR)/z2.pmc
+
+# the default target
+z2.pbc: $(PARROT) $(SOURCES)
+	$(PARROT) $(PARROT_ARGS) -o z2.pbc z2.pir
+
+src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/words.pg
+	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
+	    --output=src/gen_grammar.pir \
+	    src/parser/grammar.pg \
+	    src/parser/words.pg \
+
+src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
+	$(PARROT) $(PARROT_ARGS) $(NQP) --output=src/gen_actions.pir \
+	    --target=pir src/parser/actions.pm
+
+src/gen_builtins.pir: $(BUILTINS_PIR)
+	$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
+
+$(Z2_GROUP): $(PARROT) $(PMC_SOURCES)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) generate $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) compile $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) linklibs $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) copy --destination=$(PARROT_DYNEXT) $(PMCS)
+
+# regenerate the Makefile
+Makefile: config/makefiles/root.in
+	cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=z2
+
+# This is a listing of all targets, that are meant to be called by users
+help:
+	@echo ""
+	@echo "Following targets are available for the user:"
+	@echo ""
+	@echo "  all:               z2.pbc"
+	@echo "                     This is the default."
+	@echo "Testing:"
+	@echo "  test:              Run the test suite."
+	@echo "  testclean:         Clean up test results."
+	@echo ""
+	@echo "Cleaning:"
+	@echo "  clean:             Basic cleaning up."
+	@echo "  realclean:         Removes also files generated by 'Configure.pl'"
+	@echo "  distclean:         Removes also anything built, in theory"
+	@echo ""
+	@echo "Misc:"
+	@echo "  help:              Print this help message."
+	@echo ""
+
+test: all
+	$(PERL) t/harness
+
+# this target has nothing to do
+testclean:
+
+CLEANUPS = \
+  z2.pbc \
+  src/gen_grammar.pir \
+  src/gen_actions.pir \
+  src/gen_builtins.pir \
+  $(PMC_DIR)/*.h \
+  $(PMC_DIR)/*.c \
+  $(PMC_DIR)/*.dump \
+  $(PMC_DIR)/*$(O) \
+  $(PMC_DIR)/*$(LOAD_EXT) \
+  $(PMC_DIR)/*.exp \
+  $(PMC_DIR)/*.ilk \
+  $(PMC_DIR)/*.manifest \
+  $(PMC_DIR)/*.pdb \
+  $(PMC_DIR)/*.lib \
+
+
+clean: testclean
+	$(RM_RF) $(CLEANUPS)
+
+realclean: clean
+	$(RM_RF) Makefile
+
+distclean: realclean
+
+
+Language 'z2' was created with tools/dev/mk_language_shell.pl, r32060.
+

File config/makefiles/root.in

+## $Id$
+
+## arguments we want to run parrot with
+PARROT_ARGS =
+
+## configuration settings
+BUILD_DIR     = @build_dir@
+LOAD_EXT      = @load_ext@
+O             = @o@
+
+## Setup some commands
+LN_S          = @lns@
+PERL          = @perl@
+RM_RF         = @rm_rf@
+CP            = @cp@
+PARROT        = ../../parrot@exe@
+CAT           = $(PERL) -MExtUtils::Command -e cat
+BUILD_DYNPMC  = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
+RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
+#CONDITIONED_LINE(darwin):
+#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
+#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
+
+## places to look for things
+PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
+PGE_LIBRARY   = $(BUILD_DIR)/runtime/parrot/library/PGE
+PERL6GRAMMAR  = $(PGE_LIBRARY)/Perl6Grammar.pbc
+NQP           = $(BUILD_DIR)/compilers/nqp/nqp.pbc
+PCT           = $(BUILD_DIR)/runtime/parrot/library/PCT.pbc
+
+PMC_DIR       = src/pmc
+
+all: z2.pbc
+
+Z2_GROUP = $(PMC_DIR)/z2_group$(LOAD_EXT)
+
+SOURCES = z2.pir \
+  src/gen_grammar.pir \
+  src/gen_actions.pir \
+  src/gen_builtins.pir \
+#  $(Z2_GROUP)
+
+BUILTINS_PIR = \
+  src/builtins/say.pir \
+
+# PMCS = z2
+# PMC_SOURCES = $(PMC_DIR)/z2.pmc
+
+# the default target
+z2.pbc: $(PARROT) $(SOURCES)
+	$(PARROT) $(PARROT_ARGS) -o z2.pbc z2.pir
+
+src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/grammar-oper.pg
+	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
+	    --output=src/gen_grammar.pir \
+	    src/parser/grammar.pg \
+	    src/parser/grammar-oper.pg \
+
+src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
+	$(PARROT) $(PARROT_ARGS) $(NQP) --output=src/gen_actions.pir \
+	    --target=pir src/parser/actions.pm
+
+src/gen_builtins.pir: $(BUILTINS_PIR)
+	$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
+
+$(Z2_GROUP): $(PARROT) $(PMC_SOURCES)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) generate $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) compile $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) linklibs $(PMCS)
+	cd $(PMC_DIR) && $(BUILD_DYNPMC) copy --destination=$(PARROT_DYNEXT) $(PMCS)
+
+# regenerate the Makefile
+Makefile: config/makefiles/root.in
+	cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=z2
+
+# This is a listing of all targets, that are meant to be called by users
+help:
+	@echo ""
+	@echo "Following targets are available for the user:"
+	@echo ""
+	@echo "  all:               z2.pbc"
+	@echo "                     This is the default."
+	@echo "Testing:"
+	@echo "  test:              Run the test suite."
+	@echo "  testclean:         Clean up test results."
+	@echo ""
+	@echo "Cleaning:"
+	@echo "  clean:             Basic cleaning up."
+	@echo "  realclean:         Removes also files generated by 'Configure.pl'"
+	@echo "  distclean:         Removes also anything built, in theory"
+	@echo ""
+	@echo "Misc:"
+	@echo "  help:              Print this help message."
+	@echo ""
+
+test: all
+	$(PERL) t/harness
+
+# this target has nothing to do
+testclean:
+
+CLEANUPS = \
+  z2.pbc \
+  src/gen_grammar.pir \
+  src/gen_actions.pir \
+  src/gen_builtins.pir \
+  $(PMC_DIR)/*.h \
+  $(PMC_DIR)/*.c \
+  $(PMC_DIR)/*.dump \
+  $(PMC_DIR)/*$(O) \
+  $(PMC_DIR)/*$(LOAD_EXT) \
+  $(PMC_DIR)/*.exp \
+  $(PMC_DIR)/*.ilk \
+  $(PMC_DIR)/*.manifest \
+  $(PMC_DIR)/*.pdb \
+  $(PMC_DIR)/*.lib \
+
+
+clean: testclean
+	$(RM_RF) $(CLEANUPS)
+
+realclean: clean
+	$(RM_RF) Makefile
+
+distclean: realclean
+
+

File shakespeare.pir

+=head1 TITLE
+
+shakespeare.pir - A shakespeare compiler.
+
+=head2 Description
+
+This is the base file for the shakespeare compiler.
+
+This file includes the parsing and grammar rules from
+the src/ directory, loads the relevant PGE libraries,
+and registers the compiler under the name 'shakespeare'.
+
+=head2 Functions
+
+=over 4
+
+=item onload()
+
+Creates the shakespeare compiler using a C<PCT::HLLCompiler>
+object.
+
+=cut
+
+.namespace [ 'shakespeare';'Compiler' ]
+
+.loadlib 'shakespeare_group'
+
+.sub 'onload' :anon :load :init
+    .local pmc p6meta
+    load_bytecode 'PCT.pbc'
+
+    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
+    $P1 = $P0.'new'()
+
+    p6meta = new 'P6metaclass'
+    $P0 = p6meta.'new_class'('shakespeare::Compiler', 'parent'=>'PCT::HLLCompiler')
+    $P1 = $P0.'new'()
+    $P1.'language'('shakespeare')
+    $P1.'parsegrammar'('shakespeare::Grammar')
+    $P1.'parseactions'('shakespeare::Grammar::Actions')
+    $P1.'addstage'('lc', 'before'=>'parse')
+.end
+
+.sub 'lc' :method
+    .param string source
+    .param pmc adverbs         :slurpy :named
+
+    downcase source
+    .return (source)
+.end
+
+=item main(args :slurpy)  :main
+
+Start compilation by passing any command line C<args>
+to the shakespeare compiler.
+
+=cut
+
+.sub 'main' :main
+    .param pmc args
+
+    $P0 = compreg 'shakespeare'
+    $P1 = $P0.'command_line'(args)
+.end
+
+
+
+.include 'src/gen_builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/gen_actions.pir'
+
+=back
+
+=cut
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

File src/builtins/say.pir

+# $Id$
+
+=head1
+
+say.pir -- simple implementation of a say function
+
+=cut
+
+.namespace []
+
+.sub 'say'
+    .param pmc args            :slurpy
+    .local pmc iter
+    iter = new 'Iterator', args
+  iter_loop:
+    unless iter goto iter_end
+    $P0 = shift iter
+    print $P0
+    goto iter_loop
+  iter_end:
+    print "\n"
+    .return ()
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

File src/gen_actions.pir

+
+.namespace []
+.sub "_block11"  :anon :subid("10")
+    get_hll_global $P14, ["z2";"Grammar";"Actions"], "_block13" 
+    .return ($P14)
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "_block13" :init :load :subid("20")
+    .const 'Sub' $P107 = "18" 
+    capture_lex $P107
+    .const 'Sub' $P90 = "17" 
+    capture_lex $P90
+    .const 'Sub' $P78 = "16" 
+    capture_lex $P78
+    .const 'Sub' $P53 = "14" 
+    capture_lex $P53
+    .const 'Sub' $P41 = "13" 
+    capture_lex $P41
+    .const 'Sub' $P15 = "11" 
+    capture_lex $P15
+        $P0 = get_hll_global 'P6metaclass'
+        $P1 = split '::', 'z2::Grammar::Actions'
+        push_eh subclass_done
+        $P2 = $P0.'new_class'($P1)
+      subclass_done:
+        pop_eh
+    .const 'Sub' $P107 = "18" 
+    capture_lex $P107
+    .return ($P107)
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "TOP"  :subid("11") :method :outer("20")
+    .param pmc param_18
+    new $P17, 'ExceptionHandler'
+    set_addr $P17, control_16
+    $P17."handle_types"(58)
+    push_eh $P17
+    .lex "$/", param_18
+    get_hll_global $P19, ["PAST"], "Block"
+    find_lex $P20, "$/"
+    unless_null $P20, vivify_21
+    new $P20, "Undef"
+  vivify_21:
+    $P21 = $P19."new"($P20 :named("node"))
+    .lex "$past", $P21
+    find_lex $P23, "$/"
+    set $P24, $P23["value"]
+    unless_null $P24, vivify_22
+    new $P24, "Undef"
+  vivify_22:
+    defined $I25, $P24
+    unless $I25, for_undef_23
+    iter $P22, $P24
+    new $P35, 'ExceptionHandler'
+    set_addr $P35, loop34_handler
+    $P35."handle_types"(64, 66, 65)
+    push_eh $P35
+  loop34_test:
+    unless $P22, loop34_done
+    shift $P26, $P22
+  loop34_redo:
+    .const 'Sub' $P28 = "12" 
+    capture_lex $P28
+    $P28($P26)
+  loop34_next:
+    goto loop34_test
+  loop34_handler:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P36, exception, 'type'
+    eq $P36, 64, loop34_next
+    eq $P36, 66, loop34_redo
+  loop34_done:
+    pop_eh 
+  for_undef_23:
+    find_lex $P37, "$/"
+    find_lex $P38, "$past"
+    unless_null $P38, vivify_26
+    new $P38, "Undef"
+  vivify_26:
+    $P39 = $P37."result_object"($P38)
+    .return ($P39)
+  control_16:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P40, exception, "payload"
+    .return ($P40)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "_block27"  :anon :subid("12") :outer("11")
+    .param pmc param_29
+    .lex "$_", param_29
+    find_lex $P30, "$past"
+    unless_null $P30, vivify_24
+    new $P30, "Undef"
+  vivify_24:
+    find_lex $P31, "$_"
+    unless_null $P31, vivify_25
+    new $P31, "Undef"
+  vivify_25:
+    $P32 = $P31."item"()
+    $P33 = $P30."push"($P32)
+    .return ($P33)
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "value"  :subid("13") :method :outer("20")
+    .param pmc param_44
+    .param pmc param_45
+    new $P43, 'ExceptionHandler'
+    set_addr $P43, control_42
+    $P43."handle_types"(58)
+    push_eh $P43
+    .lex "$/", param_44
+    .lex "$key", param_45
+    "say"("va")
+    find_lex $P46, "$/"
+    find_lex $P47, "$key"
+    unless_null $P47, vivify_27
+    new $P47, "Undef"
+  vivify_27:
+    find_lex $P48, "$/"
+    unless_null $P48, vivify_28
+    new $P48, "Hash"
+  vivify_28:
+    set $P49, $P48[$P47]
+    unless_null $P49, vivify_29
+    new $P49, "Undef"
+  vivify_29:
+    $P50 = $P49."item"()
+    $P51 = $P46."result_object"($P50)
+    .return ($P51)
+  control_42:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P52, exception, "payload"
+    .return ($P52)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "immediate"  :subid("14") :method :outer("20")
+    .param pmc param_56
+    new $P55, 'ExceptionHandler'
+    set_addr $P55, control_54
+    $P55."handle_types"(58)
+    push_eh $P55
+    .lex "$/", param_56
+    "say"("imm")
+    new $P57, "Integer"
+    assign $P57, 1
+    .lex "$value", $P57
+    find_lex $P59, "$/"
+    set $P60, $P59["adjective"]
+    unless_null $P60, vivify_30
+    new $P60, "Undef"
+  vivify_30:
+    defined $I61, $P60
+    unless $I61, for_undef_31
+    iter $P58, $P60
+    new $P69, 'ExceptionHandler'
+    set_addr $P69, loop68_handler
+    $P69."handle_types"(64, 66, 65)
+    push_eh $P69
+  loop68_test:
+    unless $P58, loop68_done
+    shift $P62, $P58
+  loop68_redo:
+    .const 'Sub' $P64 = "15" 
+    capture_lex $P64
+    $P64($P62)
+  loop68_next:
+    goto loop68_test
+  loop68_handler:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P70, exception, 'type'
+    eq $P70, 64, loop68_next
+    eq $P70, 66, loop68_redo
+  loop68_done:
+    pop_eh 
+  for_undef_31:
+    find_lex $P71, "$/"
+    get_hll_global $P72, ["PAST"], "Val"
+    find_lex $P73, "$value"
+    unless_null $P73, vivify_33
+    new $P73, "Undef"
+  vivify_33:
+    find_lex $P74, "$/"
+    unless_null $P74, vivify_34
+    new $P74, "Undef"
+  vivify_34:
+    $P75 = $P72."new"($P73 :named("value"), "Integer" :named("returns"), $P74 :named("node"))
+    $P76 = $P71."result_object"($P75)
+    .return ($P76)
+  control_54:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P77, exception, "payload"
+    .return ($P77)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "_block63"  :anon :subid("15") :outer("14")
+    .param pmc param_65
+    .lex "$_", param_65
+    find_lex $P66, "$value"
+    unless_null $P66, vivify_32
+    new $P66, "Undef"
+  vivify_32:
+    mul $P67, $P66, 2
+    store_lex "$value", $P67
+    .return ($P67)
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "computation"  :subid("16") :method :outer("20")
+    .param pmc param_81
+    .param pmc param_82
+    new $P80, 'ExceptionHandler'
+    set_addr $P80, control_79
+    $P80."handle_types"(58)
+    push_eh $P80
+    .lex "$/", param_81
+    .lex "$key", param_82
+    find_lex $P83, "$/"
+    find_lex $P84, "$key"
+    unless_null $P84, vivify_35
+    new $P84, "Undef"
+  vivify_35:
+    find_lex $P85, "$/"
+    unless_null $P85, vivify_36
+    new $P85, "Hash"
+  vivify_36:
+    set $P86, $P85[$P84]
+    unless_null $P86, vivify_37
+    new $P86, "Undef"
+  vivify_37:
+    $P87 = $P86."item"()
+    $P88 = $P83."result_object"($P87)
+    .return ($P88)
+  control_79:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P89, exception, "payload"
+    .return ($P89)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "unary"  :subid("17") :method :outer("20")
+    .param pmc param_93
+    .param pmc param_94
+    new $P92, 'ExceptionHandler'
+    set_addr $P92, control_91
+    $P92."handle_types"(58)
+    push_eh $P92
+    .lex "$/", param_93
+    .lex "$key", param_94
+    get_hll_global $P95, ["PAST"], "Op"
+    find_lex $P96, "$key"
+    unless_null $P96, vivify_38
+    new $P96, "Undef"
+  vivify_38:
+    find_lex $P97, "$/"
+    unless_null $P97, vivify_39
+    new $P97, "Undef"
+  vivify_39:
+    $P98 = $P95."new"($P96 :named("name"), "call" :named("pasttype"), $P97 :named("node"))
+    .lex "$res", $P98
+    find_lex $P99, "$res"
+    unless_null $P99, vivify_40
+    new $P99, "Undef"
+  vivify_40:
+    find_lex $P100, "$/"
+    set $P101, $P100["value"]
+    unless_null $P101, vivify_41
+    new $P101, "Undef"
+  vivify_41:
+    $P102 = $P101."item"()
+    $P99."push"($P102)
+    find_lex $P103, "$/"
+    find_lex $P104, "$res"
+    unless_null $P104, vivify_42
+    new $P104, "Undef"
+  vivify_42:
+    $P105 = $P103."result_object"($P104)
+    .return ($P105)
+  control_91:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P106, exception, "payload"
+    .return ($P106)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "binary"  :subid("18") :method :outer("20")
+    .param pmc param_110
+    .param pmc param_111
+    new $P109, 'ExceptionHandler'
+    set_addr $P109, control_108
+    $P109."handle_types"(58)
+    push_eh $P109
+    .lex "$/", param_110
+    .lex "$key", param_111
+    get_hll_global $P112, ["PAST"], "Op"
+    find_lex $P113, "$key"
+    unless_null $P113, vivify_43
+    new $P113, "Undef"
+  vivify_43:
+    find_lex $P114, "$/"
+    unless_null $P114, vivify_44
+    new $P114, "Undef"
+  vivify_44:
+    $P115 = $P112."new"($P113 :named("name"), "call" :named("pasttype"), $P114 :named("node"))
+    .lex "$res", $P115
+    find_lex $P117, "$/"
+    set $P118, $P117["value"]
+    unless_null $P118, vivify_45
+    new $P118, "Undef"
+  vivify_45:
+    defined $I119, $P118
+    unless $I119, for_undef_46
+    iter $P116, $P118
+    new $P129, 'ExceptionHandler'
+    set_addr $P129, loop128_handler
+    $P129."handle_types"(64, 66, 65)
+    push_eh $P129
+  loop128_test:
+    unless $P116, loop128_done
+    shift $P120, $P116
+  loop128_redo:
+    .const 'Sub' $P122 = "19" 
+    capture_lex $P122
+    $P122($P120)
+  loop128_next:
+    goto loop128_test
+  loop128_handler:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P130, exception, 'type'
+    eq $P130, 64, loop128_next
+    eq $P130, 66, loop128_redo
+  loop128_done:
+    pop_eh 
+  for_undef_46:
+    find_lex $P131, "$/"
+    find_lex $P132, "$res"
+    unless_null $P132, vivify_49
+    new $P132, "Undef"
+  vivify_49:
+    $P133 = $P131."result_object"($P132)
+    .return ($P133)
+  control_108:
+    .local pmc exception 
+    .get_results (exception) 
+    getattribute $P134, exception, "payload"
+    .return ($P134)
+    rethrow exception
+.end
+
+
+.namespace ["z2";"Grammar";"Actions"]
+.sub "_block121"  :anon :subid("19") :outer("18")
+    .param pmc param_123
+    .lex "$_", param_123
+    find_lex $P124, "$res"
+    unless_null $P124, vivify_47
+    new $P124, "Undef"
+  vivify_47:
+    find_lex $P125, "$_"
+    unless_null $P125, vivify_48
+    new $P125, "Undef"
+  vivify_48:
+    $P126 = $P125."item"()
+    $P127 = $P124."push"($P126)
+    .return ($P127)
+.end
+

File src/gen_builtins.pir

+# $Id$
+
+=head1
+
+say.pir -- simple implementation of a say function
+
+=cut
+
+.namespace []
+
+.sub 'say'
+    .param pmc args            :slurpy
+    .local pmc iter
+    iter = new 'Iterator', args
+  iter_loop:
+    unless iter goto iter_end
+    $P0 = shift iter
+    print $P0
+    goto iter_loop
+  iter_end:
+    print "\n"
+    .return ()
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+