Skip to content

Commit

Permalink
[punie] Migrating Punie into 'languages' repository from
Browse files Browse the repository at this point in the history
https://svn.parrot.org/parrot/trunk/languages/punie (not replaying
revision history).
  • Loading branch information
allisonrandal committed Feb 27, 2009
0 parents commit 11e6f96
Show file tree
Hide file tree
Showing 81 changed files with 4,810 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MAINTAINER
@@ -0,0 +1,4 @@
# $Id: MAINTAINER 18122 2007-04-10 16:58:56Z bernhard $

N: Allison Randal
E: allison@perl.org
82 changes: 82 additions & 0 deletions Makefile
@@ -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 changes: 55 additions & 0 deletions 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
81 changes: 81 additions & 0 deletions config/makefiles/root.in
@@ -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 changes: 49 additions & 0 deletions 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";

0 comments on commit 11e6f96

Please sign in to comment.