Permalink
Browse files

[punie] Migrating Punie into 'languages' repository from

https://svn.parrot.org/parrot/trunk/languages/punie (not replaying
revision history).
  • Loading branch information...
0 parents commit 11e6f9656cad9bf7ac8fb80959ca70991e6521b5 @allisonrandal allisonrandal committed Feb 27, 2009
Showing with 4,810 additions and 0 deletions.
  1. +4 −0 MAINTAINER
  2. +82 −0 Makefile
  3. +55 −0 README
  4. +81 −0 config/makefiles/root.in
  5. +49 −0 demo.p1
  6. +126 −0 overview.pod
  7. +62 −0 punie.pir
  8. +427 −0 src/builtins/builtins.pir
  9. +409 −0 src/parser/actions.pm
  10. +328 −0 src/parser/grammar.pg
  11. +94 −0 t/base_cond.t
  12. +105 −0 t/base_if.t
  13. +66 −0 t/base_lex.t
  14. +103 −0 t/base_loop.t
  15. +41 −0 t/base_pat.t
  16. +70 −0 t/base_term.t
  17. +57 −0 t/cmd_elsif.t
  18. +55 −0 t/cmd_for.t
  19. +91 −0 t/cmd_subval.t
  20. +205 −0 t/comp_cmdopt.t
  21. +84 −0 t/comp_decl.t
  22. +64 −0 t/comp_term.t
  23. +68 −0 t/distro/TEST
  24. +19 −0 t/distro/base.cond
  25. +11 −0 t/distro/base.if
  26. +32 −0 t/distro/base.lex
  27. +11 −0 t/distro/base.pat
  28. +36 −0 t/distro/base.term
  29. +25 −0 t/distro/cmd.elsif
  30. +25 −0 t/distro/cmd.for
  31. +28 −0 t/distro/cmd.mod
  32. +50 −0 t/distro/cmd.subval
  33. +110 −0 t/distro/cmd.while
  34. +83 −0 t/distro/comp.cmdopt
  35. +35 −0 t/distro/comp.cpp
  36. +49 −0 t/distro/comp.decl
  37. +40 −0 t/distro/comp.multiline
  38. +23 −0 t/distro/comp.script
  39. +27 −0 t/distro/comp.term
  40. +36 −0 t/distro/io.argv
  41. +63 −0 t/distro/io.fs
  42. +19 −0 t/distro/io.inplace
  43. +25 −0 t/distro/io.print
  44. +42 −0 t/distro/io.tell
  45. +21 −0 t/distro/op.append
  46. +41 −0 t/distro/op.auto
  47. +21 −0 t/distro/op.chop
  48. +12 −0 t/distro/op.cond
  49. +12 −0 t/distro/op.crypt
  50. +34 −0 t/distro/op.do
  51. +50 −0 t/distro/op.each
  52. +20 −0 t/distro/op.eval
  53. +12 −0 t/distro/op.exec
  54. +27 −0 t/distro/op.exp
  55. +26 −0 t/distro/op.flip
  56. +16 −0 t/distro/op.fork
  57. +34 −0 t/distro/op.goto
  58. +17 −0 t/distro/op.int
  59. +12 −0 t/distro/op.join
  60. +34 −0 t/distro/op.list
  61. +27 −0 t/distro/op.magic
  62. +9 −0 t/distro/op.oct
  63. +14 −0 t/distro/op.ord
  64. +56 −0 t/distro/op.pat
  65. +11 −0 t/distro/op.push
  66. +32 −0 t/distro/op.repeat
  67. +8 −0 t/distro/op.sleep
  68. +31 −0 t/distro/op.split
  69. +8 −0 t/distro/op.sprintf
  70. +29 −0 t/distro/op.stat
  71. +38 −0 t/distro/op.subst
  72. +45 −0 t/distro/op.time
  73. +14 −0 t/distro/op.unshift
  74. +3 −0 t/harness
  75. +146 −0 t/io_print.t
  76. +105 −0 t/op_do.t
  77. +90 −0 t/op_each.t
  78. +71 −0 t/op_goto.t
  79. +82 −0 t/op_list.t
  80. +63 −0 t/op_math.t
  81. +24 −0 t/op_string.t
@@ -0,0 +1,4 @@
+# $Id: MAINTAINER 18122 2007-04-10 16:58:56Z bernhard $
+
+N: Allison Randal
+E: allison@perl.org
@@ -0,0 +1,82 @@
+# ex: set ro:
+# DO NOT EDIT THIS FILE
+# Generated by Parrot::Configure::Compiler from languages/punie/config/makefiles/root.in
+
+# Copyright (C) 2005-2009, Parrot Foundation.
+# $Id: root.in 36833 2009-02-17 20:09:26Z allison $
+
+# Setup some commands
+LN_S = /bin/ln -s
+PERL = /usr/bin/perl
+RM_F = $(PERL) -MExtUtils::Command -e rm_f
+PARROT = ../../parrot
+BUILD_DIR = /home/allison/projects/svn/parrot
+RECONFIGURE = $(PERL) /home/allison/projects/svn/parrot/tools/dev/reconfigure.pl
+PGE_DIR = ../../compilers/pge
+NQP_DIR = ../../compilers/nqp
+CP = $(PERL) -MExtUtils::Command -e cp
+
+PARROT_LIBRARY = ../../runtime/parrot/library
+PGE_LIBRARY = ../../runtime/parrot/library/PGE
+
+# the default target
+all: punie.pbc
+
+SOURCES = punie.pir \
+ src/parser/grammar.pg \
+ src/parser/actions.pm \
+ src/builtins/builtins.pir \
+
+# the default target
+punie.pbc: $(PARROT) $(NQP_DIR)/nqp.pbc $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
+ $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir --output=src/gen_punie.pir src/parser/grammar.pg
+ $(PARROT) $(NQP_DIR)/nqp.pbc --target=pir --output=src/gen_punie-actions.pir src/parser/actions.pm
+ $(PARROT) -o punie.pbc punie.pir
+
+# 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: punie.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) -Ilib -I../../lib t/harness
+
+# regenerate the Makefile
+Makefile: config/makefiles/root.in
+ cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=punie
+
+testclean:
+ $(RM_F) "t/*.p1" "t/*.out" "t/*.pir"
+
+CLEANUPS = \
+ punie.pbc \
+ src/gen_punie.pir \
+ src/gen_punie-actions.pir \
+
+clean: testclean
+ $(RM_F) $(CLEANUPS)
+
+realclean: clean
+ $(RM_F) Makefile
+
+distclean: realclean
+
+# Local variables:
+# mode: makefile
+# End:
+# vim: ft=make:
55 README
@@ -0,0 +1,55 @@
+This is Punie, version 0.1.0
+-----------------------------
+
+Description
+-----------
+
+Perl1 implemented in PIR with the help of
+TGE, Tree Grammar Engine, and PGE, Parrot Grammar Engine.
+
+Status
+------
+
+So far, Punie handles constants (strings, integers, floats), variables, print
+statements, conditionals, do blocks, comma lists, and some basic math
+and logic ops.
+
+Punie is Copyright (C) 2005-2006, Parrot Foundation.
+
+LICENSE INFORMATION
+-------------------
+
+This code is distributed under the same license as Parrot; you can
+redistribute it and/or modify it under the terms of either:
+
+ a) the GNU General Public License
+
+ b) the "Artistic License"
+
+as found in the "LICENSES" directory at the top level of the Parrot
+distribution.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
+the GNU General Public License or the Artistic License for more
+details.
+
+PREREQUISITES
+-------------
+
+Punie depends on Parrot, particularly on version 0.2.2 or higher, when
+grammar support was introduced to PGE (the Parrot grammar engine).
+
+INSTRUCTIONS
+------------
+
+Compile Punie to bytecode and run its test suite:
+
+ $ make
+ $ make test
+
+Run the Punie compiler via Parrot, passing it the path to a Perl 1
+source file as the only argument:
+
+ $ ./parrot languages/punie/punie.pbc demo.p1
@@ -0,0 +1,81 @@
+# Copyright (C) 2005-2009, Parrot Foundation.
+# $Id: root.in 36833 2009-02-17 20:09:26Z allison $
+
+# Setup some commands
+LN_S = @lns@
+PERL = @perl@
+RM_F = @rm_f@
+PARROT = ../../parrot@exe@
+BUILD_DIR = @build_dir@
+RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl
+PGE_DIR = ../../compilers/pge
+NQP_DIR = ../../compilers/nqp
+CP = @cp@
+#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@
+
+PARROT_LIBRARY = ../../runtime/parrot/library
+PGE_LIBRARY = ../../runtime/parrot/library/PGE
+
+# the default target
+all: punie.pbc
+
+SOURCES = punie.pir \
+ src/parser/grammar.pg \
+ src/parser/actions.pm \
+ src/builtins/builtins.pir \
+
+# the default target
+punie.pbc: $(PARROT) $(NQP_DIR)/nqp.pbc $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
+ $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir --output=src/gen_punie.pir src/parser/grammar.pg
+ $(PARROT) $(NQP_DIR)/nqp.pbc --target=pir --output=src/gen_punie-actions.pir src/parser/actions.pm
+ $(PARROT) -o punie.pbc punie.pir
+
+# 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: punie.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) -Ilib -I../../lib t/harness
+
+# regenerate the Makefile
+Makefile: config/makefiles/root.in
+ cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=punie
+
+testclean:
+ $(RM_F) "t/*.p1" "t/*.out" "t/*.pir"
+
+CLEANUPS = \
+ punie.pbc \
+ src/gen_punie.pir \
+ src/gen_punie-actions.pir \
+
+clean: testclean
+ $(RM_F) $(CLEANUPS)
+
+realclean: clean
+ $(RM_F) Makefile
+
+distclean: realclean
+
+# Local variables:
+# mode: makefile
+# End:
+# vim: ft=make:
49 demo.p1
@@ -0,0 +1,49 @@
+print 1;
+print 2, "\n";
+print 34, "\n";
+print 5.6, "\n";
+print 'ok 7\n', "\n"; # show '\n' is literal
+print "ok 8\n";
+print "ok 9\n","ok 10\n","ok 11\n","ok 12\n";
+label1: print "ok 13\n";
+label2: print "ok 14\n";
+print 1 - 2 - 3;
+print "\n";
+print 1 + 2, "\n", 2 + 3, "\n";
+
+do {
+ print "ok 15\n";
+ print "ok 16\n";
+ print "ok 17\n";
+};
+
+if (1) {
+ print "ok 18\n";
+}
+if (0) {
+ print "should never be printed\n";
+}
+unless (1 - 1) {
+ print "ok 19\n";
+}
+unless (1) {
+ print "should never be printed\n";
+}
+
+# comment
+
+$x = 4;
+
+if ($x >= 4) {
+ print "ok 20\n";
+}
+if ($x <= 5) {
+ print "ok 21\n";
+}
+
+
+$y = 1 + 1 && 11 + 11;
+print "ok ", $y, "\n";
+
+$z = 0 || 23;
+print "ok ", $z, "\n";
Oops, something went wrong.

0 comments on commit 11e6f96

Please sign in to comment.