Author: chromatic
Date: Sat Apr 29 19:43:47 2006
New Revision: 12458
Added:
trunk/compilers/past/
trunk/compilers/past/Node.pir
- copied, changed from r12454, /trunk/languages/punie/lib/Node.pir
trunk/compilers/past/PAST/
trunk/compilers/past/PAST.pir
- copied, changed from r12451, /trunk/languages/punie/lib/PAST.pir
trunk/compilers/past/PAST/Code.pir
- copied unchanged from r12451, /trunk/languages/punie/lib/PAST/Code.pir
trunk/compilers/past/PAST/Exp.pir
- copied unchanged from r12451, /trunk/languages/punie/lib/PAST/Exp.pir
trunk/compilers/past/PAST/Op.pir
- copied unchanged from r12453, /trunk/languages/punie/lib/PAST/Op.pir
trunk/compilers/past/PAST/Stmt.pir
- copied unchanged from r12451, /trunk/languages/punie/lib/PAST/Stmt.pir
trunk/compilers/past/PAST/Stmts.pir
- copied unchanged from r12451, /trunk/languages/punie/lib/PAST/Stmts.pir
trunk/compilers/past/PAST/Sub.pir
- copied, changed from r12451, /trunk/languages/punie/lib/PAST/Sub.pir
trunk/compilers/past/PAST/Val.pir
- copied unchanged from r12453, /trunk/languages/punie/lib/PAST/Val.pir
trunk/compilers/past/PAST/Var.pir
- copied unchanged from r12451, /trunk/languages/punie/lib/PAST/Var.pir
trunk/compilers/past/t/
trunk/compilers/post/
trunk/config/gen/makefiles/past.in
Removed:
trunk/languages/pheme/lib/PAST/
trunk/languages/pheme/lib/PAST.pir
trunk/languages/punie/lib/Node.pir
trunk/languages/punie/lib/PAST.pir
trunk/languages/punie/lib/PAST/Code.pir
trunk/languages/punie/lib/PAST/Exp.pir
trunk/languages/punie/lib/PAST/Op.pir
trunk/languages/punie/lib/PAST/Stmt.pir
trunk/languages/punie/lib/PAST/Stmts.pir
trunk/languages/punie/lib/PAST/Sub.pir
trunk/languages/punie/lib/PAST/Val.pir
trunk/languages/punie/lib/PAST/Var.pir
Modified:
trunk/MANIFEST
trunk/config/gen/makefiles.pm
trunk/config/gen/makefiles/pheme.in
trunk/languages/pheme/lib/PhemeCompiler.pir
trunk/languages/pheme/lib/past2post.tg
trunk/languages/pheme/lib/pge2past.tg
trunk/languages/pheme/lib/pheme.g
trunk/languages/punie/lib/ASTGrammar.pir
trunk/languages/punie/lib/POST.pir
trunk/languages/punie/punie.pir
trunk/languages/punie/t/node.t
trunk/languages/punie/t/past.t
trunk/languages/punie/t/past_op.t
trunk/languages/punie/t/past_val.t
Log:
Merged PAST from Punie and Pheme and moved it to compilers/past/.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Sat Apr 29 19:43:47 2006
@@ -70,6 +70,16 @@
compilers/imcc/symreg.c []
compilers/imcc/symreg.h []
compilers/imcc/unit.h []
+compilers/past/Node.pir [past]
+compilers/past/PAST.pir [past]
+compilers/past/PAST/Code.pir [past]
+compilers/past/PAST/Exp.pir [past]
+compilers/past/PAST/Op.pir [past]
+compilers/past/PAST/Stmt.pir [past]
+compilers/past/PAST/Stmts.pir [past]
+compilers/past/PAST/Sub.pir [past]
+compilers/past/PAST/Val.pir [past]
+compilers/past/PAST/Var.pir [past]
compilers/pge/demo.pir []
compilers/pge/P6Rule.grammar []
compilers/pge/PGE.pir []
@@ -187,6 +197,7 @@
config/gen/makefiles/ook.in []
config/gen/makefiles/parrot_compiler.in []
config/gen/makefiles/parrot.pc.in []
+config/gen/makefiles/past.in []
config/gen/makefiles/pge.in []
config/gen/makefiles/punie.in []
config/gen/makefiles/regex.in []
@@ -1124,8 +1135,6 @@
languages/punie/punie.pir [punie]
languages/punie/overview.pod [punie]
languages/punie/README [punie]
-languages/punie/lib/Node.pir [punie]
-languages/punie/lib/PAST.pir [punie]
languages/punie/lib/past2post.tg [punie]
languages/punie/lib/punie.pg [punie]
languages/punie/lib/POST.pir [punie]
@@ -1136,14 +1145,6 @@
languages/punie/lib/OSTGrammar.pir [punie]
languages/punie/lib/ASTGrammar.pir [punie]
languages/punie/lib/PIRGrammar.pir [punie]
-languages/punie/lib/PAST/Code.pir [punie]
-languages/punie/lib/PAST/Exp.pir [punie]
-languages/punie/lib/PAST/Op.pir [punie]
-languages/punie/lib/PAST/Stmt.pir [punie]
-languages/punie/lib/PAST/Stmts.pir [punie]
-languages/punie/lib/PAST/Sub.pir [punie]
-languages/punie/lib/PAST/Val.pir [punie]
-languages/punie/lib/PAST/Var.pir [punie]
languages/punie/lib/POST/Op.pir [punie]
languages/punie/lib/POST/Sub.pir [punie]
languages/punie/lib/POST/Val.pir [punie]
@@ -1542,7 +1543,6 @@
languages/pheme/t/write.t [pheme]
languages/pheme/t/phemer/chapter_1.t [pheme]
languages/pheme/lib/past2post.tg [pheme]
-languages/pheme/lib/PAST.pir [pheme]
languages/pheme/lib/PhemeCompiler.pir [pheme]
languages/pheme/lib/PhemeSymbols.pir [pheme]
languages/pheme/lib/pheme.g [pheme]
@@ -1559,17 +1559,6 @@
languages/pheme/lib/POST/Ops.pir [pheme]
languages/pheme/lib/POST/Val.pir [pheme]
languages/pheme/lib/POST/Node.pir [pheme]
-languages/pheme/lib/PAST/Stmts.pir [pheme]
-languages/pheme/lib/PAST/Stmt.pir [pheme]
-languages/pheme/lib/PAST/Var.pir [pheme]
-languages/pheme/lib/PAST/Sub.pir [pheme]
-languages/pheme/lib/PAST/Code.pir [pheme]
-languages/pheme/lib/PAST/List.pir [pheme]
-languages/pheme/lib/PAST/Exp.pir [pheme]
-languages/pheme/lib/PAST/Op.pir [pheme]
-languages/pheme/lib/PAST/Atom.pir [pheme]
-languages/pheme/lib/PAST/Val.pir [pheme]
-languages/pheme/lib/PAST/Node.pir [pheme]
languages/unlambda/hello.unl [unlambda]
languages/unlambda/README [unlambda]
languages/unlambda/unl.pir [unlambda]
Copied: trunk/compilers/past/Node.pir (from r12454,
/trunk/languages/punie/lib/Node.pir)
==============================================================================
--- /trunk/languages/punie/lib/Node.pir (original)
+++ trunk/compilers/past/Node.pir Sat Apr 29 19:43:47 2006
@@ -36,6 +36,10 @@
.return ($I1)
.end
+.sub '__get_bool' :method
+ .return( 1 )
+.end
+
.sub source :method
.param string source :optional
.param int got_source :opt_flag
Copied: trunk/compilers/past/PAST.pir (from r12451,
/trunk/languages/punie/lib/PAST.pir)
==============================================================================
--- /trunk/languages/punie/lib/PAST.pir (original)
+++ trunk/compilers/past/PAST.pir Sat Apr 29 19:43:47 2006
@@ -15,19 +15,17 @@
.namespace [ "PAST" ]
.sub "__onload" :load
- load_bytecode "languages/punie/lib/Node.pir"
- load_bytecode "languages/punie/lib/PAST/Code.pir"
- load_bytecode "languages/punie/lib/PAST/Exp.pir"
- load_bytecode "languages/punie/lib/PAST/Op.pir"
- load_bytecode "languages/punie/lib/PAST/Stmt.pir"
- load_bytecode "languages/punie/lib/PAST/Stmts.pir"
- load_bytecode "languages/punie/lib/PAST/Sub.pir"
- load_bytecode "languages/punie/lib/PAST/Val.pir"
- load_bytecode "languages/punie/lib/PAST/Var.pir"
+ load_bytecode "Node.pbc"
+ load_bytecode "PAST/Code.pbc"
+ load_bytecode "PAST/Exp.pbc"
+ load_bytecode "PAST/Op.pbc"
+ load_bytecode "PAST/Stmt.pbc"
+ load_bytecode "PAST/Stmts.pbc"
+ load_bytecode "PAST/Sub.pbc"
+ load_bytecode "PAST/Val.pbc"
+ load_bytecode "PAST/Var.pbc"
.local pmc base
newclass base, "PAST"
addattribute base, "topnode" # the top node of the syntax tree
.return ()
.end
-
-
Copied: trunk/compilers/past/PAST/Sub.pir (from r12451,
/trunk/languages/punie/lib/PAST/Sub.pir)
==============================================================================
--- /trunk/languages/punie/lib/PAST/Sub.pir (original)
+++ trunk/compilers/past/PAST/Sub.pir Sat Apr 29 19:43:47 2006
@@ -9,12 +9,30 @@
=cut
-.namespace [ "PAST::Sub" ]
+.namespace [ 'PAST::Sub' ]
-.sub "__onload" :load
+.sub '__onload' :load
.local pmc base
$P0 = getclass 'Node'
base = subclass $P0, 'PAST::Sub'
+ addattribute base, 'name'
.return ()
.end
+.sub 'name' :method
+ .param string name :optional
+ .param int have_name :opt_flag
+
+ .local pmc name_att
+
+ unless have_name goto return_name
+
+ name_att = new .String
+ name_att = name
+ setattribute self, 'name', name_att
+ .return( name_att )
+
+ return_name:
+ name_att = getattribute self, 'name'
+ .return( name_att )
+.end
Modified: trunk/config/gen/makefiles.pm
==============================================================================
--- trunk/config/gen/makefiles.pm (original)
+++ trunk/config/gen/makefiles.pm Sat Apr 29 19:43:47 2006
@@ -82,6 +82,11 @@
conditioned_lines => 1
);
genfile(
+ 'config/gen/makefiles/past.in' => 'compilers/past/Makefile',
+ commentType => '#',
+ replace_slashes => 1
+ );
+ genfile(
'config/gen/makefiles/pge.in' => 'compilers/pge/Makefile',
commentType => '#',
replace_slashes => 1
Added: trunk/config/gen/makefiles/past.in
==============================================================================
--- (empty file)
+++ trunk/config/gen/makefiles/past.in Sat Apr 29 19:43:47 2006
@@ -0,0 +1,91 @@
+# $Id: /parrotcode/trunk/config/gen/makefiles/pge.in 16048
2006-04-27T03:57:44.847309Z pmichaud $
+
+# Setup some commands
+LN_S = @lns@
+PERL = @perl@
+RM_RF = @rm_rf@
+PARROT = ../../[EMAIL PROTECTED]@
+TOOL_DIR = ../..
+CP = @cp@
+
+# Where to put things
+PARROT_LIBRARY = ../../runtime/parrot/library
+
+# the default target
+all: $(PARROT_LIBRARY)/PAST.pbc $(PARROT_LIBRARY)/Node.pbc
+
+SOURCES = PAST.pir \
+ Node.pir \
+ PAST/Code.pir \
+ PAST/Exp.pir \
+ PAST/Op.pir \
+ PAST/Stmt.pir \
+ PAST/Stmts.pir \
+ PAST/Sub.pir \
+ PAST/Val.pir \
+ PAST/Var.pir
+
+$(PARROT_LIBRARY)/Node.pbc: Node.pbc
+ $(CP) Node.pbc $(PARROT_LIBRARY)
+
+$(PARROT_LIBRARY)/PAST.pbc: PAST.pbc
+ $(CP) PAST.pbc $(PARROT_LIBRARY)
+ $(CP) PAST/Code.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Exp.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Op.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Stmt.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Stmts.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Sub.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Val.pbc $(PARROT_LIBRARY)/PAST
+ $(CP) PAST/Var.pbc $(PARROT_LIBRARY)/PAST
+
+Node.pbc: $(PARROT) $(SOURCES)
+ $(RM_RF) Node.pbc $(PARROT_LIBRARY)/Node.pbc
+ $(PARROT) -o Node.pbc --output-pbc Node.pir
+
+PAST.pbc: $(PARROT) $(SOURCES)
+ $(RM_RF) PAST.pbc $(PARROT_LIBRARY)/PAST.pbc
+ $(PARROT) -o PAST.pbc --output-pbc PAST.pir
+ $(PARROT) -o PAST/Code.pbc --output-pbc PAST/Code.pir
+ $(PARROT) -o PAST/Exp.pbc --output-pbc PAST/Exp.pir
+ $(PARROT) -o PAST/Op.pbc --output-pbc PAST/Op.pir
+ $(PARROT) -o PAST/Stmt.pbc --output-pbc PAST/Stmt.pir
+ $(PARROT) -o PAST/Stmts.pbc --output-pbc PAST/Stmts.pir
+ $(PARROT) -o PAST/Sub.pbc --output-pbc PAST/Sub.pir
+ $(PARROT) -o PAST/Val.pbc --output-pbc PAST/Val.pir
+ $(PARROT) -o PAST/Var.pbc --output-pbc PAST/Var.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: PAST.pbc"
+ @echo " This is the default."
+ @echo ""
+ @echo "Testing:"
+ @echo " test: Run the test suite cleaning up."
+ @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
+
+# testclean:
+# $(RM_RF) "../../t/p6rules/*.pbc"
+
+# testclean
+clean:
+ $(RM_RF) PAST.pbc $(PARROT_LIBRARY)/PAST.pbc
+
+realclean: clean
+ $(RM_RF) Makefile
+
+distclean: realclean
Modified: trunk/config/gen/makefiles/pheme.in
==============================================================================
--- trunk/config/gen/makefiles/pheme.in (original)
+++ trunk/config/gen/makefiles/pheme.in Sat Apr 29 19:43:47 2006
@@ -20,12 +20,9 @@
lib/PhemeSymbols.pbc: lib/PhemeSymbols.pir
$(PARROT) -o lib/PhemeSymbols.pbc --output-pbc lib/PhemeSymbols.pir
-lib/PhemeCompiler.pbc: lib/PhemeCompiler.pir lib/PAST.pbc lib/POST.pbc
+lib/PhemeCompiler.pbc: lib/PhemeCompiler.pir lib/POST.pbc
$(PARROT) -o lib/PhemeCompiler.pbc --output-pbc lib/PhemeCompiler.pir
-lib/PAST.pbc: lib/PAST.pir
- $(PARROT) -o lib/PAST.pbc --output-pbc lib/PAST.pir
-
lib/POST.pbc: lib/POST.pir
$(PARROT) -o lib/POST.pbc --output-pbc lib/POST.pir
Modified: trunk/languages/pheme/lib/PhemeCompiler.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeCompiler.pir (original)
+++ trunk/languages/pheme/lib/PhemeCompiler.pir Sat Apr 29 19:43:47 2006
@@ -73,7 +73,8 @@
.param pmc parse_tree
load_bytecode 'TGE.pbc'
- load_bytecode 'lib/PAST.pbc'
+ load_bytecode 'Node.pbc'
+ load_bytecode 'PAST.pbc'
.local pmc compiled_symbols
compiled_symbols = new .Hash
Modified: trunk/languages/pheme/lib/past2post.tg
==============================================================================
--- trunk/languages/pheme/lib/past2post.tg (original)
+++ trunk/languages/pheme/lib/past2post.tg Sat Apr 29 19:43:47 2006
@@ -26,7 +26,7 @@
.return( result )
}
-PAST::Node: find_sub_names(.) = {
+Node: find_sub_names(.) = {
.local pmc symbols
symbols = find_global 'PhemeCompiler', 'symbols'
Modified: trunk/languages/pheme/lib/pge2past.tg
==============================================================================
--- trunk/languages/pheme/lib/pge2past.tg (original)
+++ trunk/languages/pheme/lib/pge2past.tg Sat Apr 29 19:43:47 2006
@@ -1,6 +1,6 @@
ROOT: result(.) = {
.local pmc result
- result = new 'PAST::Node'
+ result = new 'Node'
.local pmc match
match = node['list']
Modified: trunk/languages/pheme/lib/pheme.g
==============================================================================
--- trunk/languages/pheme/lib/pheme.g (original)
+++ trunk/languages/pheme/lib/pheme.g Sat Apr 29 19:43:47 2006
@@ -18,4 +18,3 @@
rule symbol_tag { \# }
rule ws { [ ; \N+ | \s ]+ }
-
Modified: trunk/languages/punie/lib/ASTGrammar.pir
==============================================================================
--- trunk/languages/punie/lib/ASTGrammar.pir (original)
+++ trunk/languages/punie/lib/ASTGrammar.pir Sat Apr 29 19:43:47 2006
@@ -11,7 +11,7 @@
grammar = new 'ASTGrammar'
# Construct the "AST"
- load_bytecode "languages/punie/lib/PAST.pir"
+ load_bytecode "PAST.pbc"
.local pmc astbuilder
astbuilder = grammar.apply(match)
.local pmc ast
Modified: trunk/languages/punie/lib/POST.pir
==============================================================================
--- trunk/languages/punie/lib/POST.pir (original)
+++ trunk/languages/punie/lib/POST.pir Sat Apr 29 19:43:47 2006
@@ -14,7 +14,7 @@
.namespace [ "POST" ]
.sub "__onload" :load
- load_bytecode "languages/punie/lib/Node.pir"
+ load_bytecode "Node.pbc"
load_bytecode "languages/punie/lib/POST/Op.pir"
load_bytecode "languages/punie/lib/POST/Ops.pir"
load_bytecode "languages/punie/lib/POST/Sub.pir"
Modified: trunk/languages/punie/punie.pir
==============================================================================
--- trunk/languages/punie/punie.pir (original)
+++ trunk/languages/punie/punie.pir Sat Apr 29 19:43:47 2006
@@ -65,7 +65,7 @@
grammar = new 'ASTGrammar'
# Construct the "AST"
- load_bytecode "languages/punie/lib/PAST.pir"
+ load_bytecode "PAST.pbc"
.local pmc astbuilder
astbuilder = grammar.apply(match)
.local pmc ast
Modified: trunk/languages/punie/t/node.t
==============================================================================
--- trunk/languages/punie/t/node.t (original)
+++ trunk/languages/punie/t/node.t Sat Apr 29 19:43:47 2006
@@ -6,14 +6,14 @@
pir_output_is(<<'CODE', <<'OUT', 'load the library');
.sub _main
- load_bytecode 'languages/punie/lib/Node.pir'
+ load_bytecode 'Node.pbc'
.end
CODE
OUT
pir_output_is(<<'CODE', <<'OUT', 'construct a node');
.sub _main
- load_bytecode 'languages/punie/lib/Node.pir'
+ load_bytecode 'Node.pbc'
.local pmc node
node = new 'Node'
.return()
@@ -23,7 +23,7 @@
pir_output_is(<<'CODE', <<'OUT', 'set attributes manually');
.sub _main
- load_bytecode 'languages/punie/lib/Node.pir'
+ load_bytecode 'Node.pbc'
.local pmc node
node = new 'Node'
$P0 = getattribute node, 'source'
@@ -53,7 +53,7 @@
pir_output_is(<<'CODE', <<'OUT', 'set attributes via method');
.sub _main
- load_bytecode 'languages/punie/lib/Node.pir'
+ load_bytecode 'Node.pbc'
.local pmc node
node = new 'Node'
node.'source'('foo')
@@ -83,7 +83,7 @@
pir_output_is(<<'CODE', <<'OUT', 'dump node structure in visual format');
.sub _main
- load_bytecode 'languages/punie/lib/Node.pir'
+ load_bytecode 'Node.pbc'
.local pmc node1
node1 = new 'Node'
node1.'source'('foo')
Modified: trunk/languages/punie/t/past.t
==============================================================================
--- trunk/languages/punie/t/past.t (original)
+++ trunk/languages/punie/t/past.t Sat Apr 29 19:43:47 2006
@@ -6,7 +6,7 @@
pir_output_is(<<'CODE', <<'OUT', 'load the libraries');
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.end
CODE
OUT
@@ -14,7 +14,7 @@
foreach my $module (qw(Code Exp Stmts Stmt Sub Var)) {
my $code = <<'CODE'
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.local pmc node
CODE
;
Modified: trunk/languages/punie/t/past_op.t
==============================================================================
--- trunk/languages/punie/t/past_op.t (original)
+++ trunk/languages/punie/t/past_op.t Sat Apr 29 19:43:47 2006
@@ -6,7 +6,7 @@
pir_output_is(<<'CODE', <<'OUT', 'set attributes via method');
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.local pmc node
node = new 'PAST::Op'
node.'source'('foo')
@@ -31,7 +31,7 @@
pir_output_is(<<'CODE', <<'OUT', 'dump node structure in visual format');
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.local pmc node
node = new 'PAST::Op'
node.'source'('foo')
Modified: trunk/languages/punie/t/past_val.t
==============================================================================
--- trunk/languages/punie/t/past_val.t (original)
+++ trunk/languages/punie/t/past_val.t Sat Apr 29 19:43:47 2006
@@ -6,7 +6,7 @@
pir_output_is(<<'CODE', <<'OUT', 'set attributes via method');
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.local pmc node
node = new 'PAST::Val'
node.'source'('foo')
@@ -31,7 +31,7 @@
pir_output_is(<<'CODE', <<'OUT', 'dump node structure in visual format');
.sub _main
- load_bytecode 'languages/punie/lib/PAST.pir'
+ load_bytecode 'PAST.pbc'
.local pmc node
node = new 'PAST::Val'
node.'source'('foo')