Author: chromatic
Date: Tue May 2 12:33:48 2006
New Revision: 12484
Modified:
trunk/languages/pheme/lib/POST.pir
trunk/languages/pheme/lib/POST/MaybeOp.pir
trunk/languages/pheme/lib/POST/Node.pir
trunk/languages/pheme/lib/POST/Op.pir
trunk/languages/pheme/lib/POST/Val.pir
trunk/languages/pheme/lib/POST/Var.pir
trunk/languages/pheme/lib/PhemeCompiler.pir
trunk/languages/pheme/lib/PhemeSymbols.pir
trunk/languages/pheme/lib/past2post.tg
trunk/languages/pheme/pheme.pir
Log:
Fix namespace issues.
Use standard Parrot PMCs, not Perl ones.
Modified: trunk/languages/pheme/lib/POST.pir
==============================================================================
--- trunk/languages/pheme/lib/POST.pir (original)
+++ trunk/languages/pheme/lib/POST.pir Tue May 2 12:33:48 2006
@@ -11,24 +11,20 @@
=cut
-.namespace [ "POST" ]
+.namespace [ 'POST' ]
-.sub "__onload" :load
- load_bytecode "lib/POST/Node.pir"
- load_bytecode "lib/POST/Op.pir"
- load_bytecode "lib/POST/Ops.pir"
- load_bytecode "lib/POST/Label.pir"
-# load_bytecode "lib/POST/Decl.pir"
-# load_bytecode "lib/POST/Stmt.pir"
-# load_bytecode "lib/POST/Stmts.pir"
- load_bytecode "lib/POST/Sub.pir"
- load_bytecode "lib/POST/Val.pir"
- load_bytecode "lib/POST/Var.pir"
-# load_bytecode "lib/POST/Code.pir"
- .local pmc base
- newclass base, "POST"
- addattribute base, "topnode" # the top node of the syntax tree
- .return ()
-.end
+.sub '__onload' :load
+ load_bytecode 'lib/POST/Node.pir'
+ load_bytecode 'lib/POST/Op.pir'
+ load_bytecode 'lib/POST/Ops.pir'
+ load_bytecode 'lib/POST/Label.pir'
+ load_bytecode 'lib/POST/Sub.pir'
+ load_bytecode 'lib/POST/Val.pir'
+ load_bytecode 'lib/POST/Var.pir'
+ .local pmc base
+ newclass base, 'POST'
+ addattribute base, 'topnode' # the top node of the syntax tree
+ .return()
+.end
Modified: trunk/languages/pheme/lib/POST/MaybeOp.pir
==============================================================================
--- trunk/languages/pheme/lib/POST/MaybeOp.pir (original)
+++ trunk/languages/pheme/lib/POST/MaybeOp.pir Tue May 2 12:33:48 2006
@@ -28,7 +28,7 @@
$P1 = source
$P2 = getattribute self, "pos"
$P2 = pos
- $P3 = new PerlString
+ $P3 = new .String
$P3 = value
setattribute self, "value", $P3
.return ()
@@ -68,7 +68,7 @@
.param int got_valtype :opt_flag
unless got_valtype goto get
set:
- $P1 = new PerlString
+ $P1 = new .String
$P1 = valtype
setattribute self, "valtype", $P1
.return ($P1)
Modified: trunk/languages/pheme/lib/POST/Node.pir
==============================================================================
--- trunk/languages/pheme/lib/POST/Node.pir (original)
+++ trunk/languages/pheme/lib/POST/Node.pir Tue May 2 12:33:48 2006
@@ -22,7 +22,7 @@
.sub __init :method
- $P1 = new PerlUndef
+ $P1 = new .Undef
$P2 = new .Integer
$P3 = new .ResizablePMCArray
$P4 = new .Hash
Modified: trunk/languages/pheme/lib/POST/Op.pir
==============================================================================
--- trunk/languages/pheme/lib/POST/Op.pir (original)
+++ trunk/languages/pheme/lib/POST/Op.pir Tue May 2 12:33:48 2006
@@ -29,7 +29,7 @@
$P1 = source
$P2 = getattribute self, "pos"
$P2 = pos
- $P3 = new PerlString
+ $P3 = new .String
$P3 = op
setattribute self, "op", $P3
unless got_children goto no_children
Modified: trunk/languages/pheme/lib/POST/Val.pir
==============================================================================
--- trunk/languages/pheme/lib/POST/Val.pir (original)
+++ trunk/languages/pheme/lib/POST/Val.pir Tue May 2 12:33:48 2006
@@ -27,7 +27,7 @@
$P1 = source
$P2 = getattribute self, "pos"
$P2 = pos
- $P3 = new PerlString
+ $P3 = new .String
$P3 = value
setattribute self, "value", $P3
.return ()
@@ -76,7 +76,7 @@
.param int got_valtype :opt_flag
unless got_valtype goto get
set:
- $P1 = new String
+ $P1 = new .String
$P1 = valtype
setattribute self, "valtype", $P1
.return ($P1)
Modified: trunk/languages/pheme/lib/POST/Var.pir
==============================================================================
--- trunk/languages/pheme/lib/POST/Var.pir (original)
+++ trunk/languages/pheme/lib/POST/Var.pir Tue May 2 12:33:48 2006
@@ -30,7 +30,7 @@
$P2 = pos
unless got_varname goto no_varname
- $P3 = new PerlString
+ $P3 = new .String
$P3 = varname
setattribute self, "varname", $P3
no_varname:
@@ -49,11 +49,11 @@
self.set_node(nodesource,nodepos)
self.new_temp()
# Then we create a child array for a fabricated op to create a new
- # pmc of type 'PerlUndef'. It has 2 arguments: the temp variable and
+ # pmc of type 'Undef'. It has 2 arguments: the temp variable and
# the type.
- $P5 = new PerlArray
+ $P5 = new .ResizablePMCArray
push $P5, self
- $I1 = find_type 'PerlUndef'
+ $I1 = find_type 'Undef'
$S10 = $I1
$P6 = new 'POST::Val'
$P6.set_node(nodesource,nodepos,$S10)
@@ -70,7 +70,7 @@
.param int got_varname :opt_flag
unless got_varname goto get
set:
- $P1 = new PerlString
+ $P1 = new .String
$P1 = varname
setattribute self, "varname", $P1
.return ($P1)
Modified: trunk/languages/pheme/lib/PhemeCompiler.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeCompiler.pir (original)
+++ trunk/languages/pheme/lib/PhemeCompiler.pir Tue May 2 12:33:48 2006
@@ -1,6 +1,9 @@
+.namespace [ 'PhemeCompiler' ]
+
.sub __onload :load
load_bytecode 'PGE.pbc'
load_bytecode 'PGE/Text.pbc'
+ .return()
.end
.sub compile_pheme
@@ -99,8 +102,7 @@
.sub get_post_tree
.param pmc past_tree
- load_bytecode 'lib/POST.pbc'
- load_bytecode 'lib/PhemeSymbols.pbc'
+ load_bytecode 'lib/POST.pir'
.local string tg_source
tg_source = _slurp_file( 'lib/past2post.tg' )
Modified: trunk/languages/pheme/lib/PhemeSymbols.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeSymbols.pir (original)
+++ trunk/languages/pheme/lib/PhemeSymbols.pir Tue May 2 12:33:48 2006
@@ -1,4 +1,4 @@
-.namespace [ 'Pheme' ]
+.namespace [ 'PhemeCompiler' ]
.sub __onload :load
.local pmc symbols
@@ -15,6 +15,8 @@
.return()
.end
+.namespace [ 'Pheme' ]
+
.sub __resolve_at_runtime
.param string symbol_name
.param pmc args :slurpy
Modified: trunk/languages/pheme/lib/past2post.tg
==============================================================================
--- trunk/languages/pheme/lib/past2post.tg (original)
+++ trunk/languages/pheme/lib/past2post.tg Tue May 2 12:33:48 2006
@@ -5,7 +5,7 @@
.local pmc symbols
symbols = tree.'get'( 'find_sub_names', node )
- store_global 'Pheme::Compiler', 'symbols', symbols
+ store_global 'PhemeCompiler', 'symbols', symbols
.local pmc child
.local pmc iter
@@ -157,7 +157,7 @@
goto iter_loop
iter_end:
- store_global 'Pheme::Compiler', 'bound_variables', variable_hash
+ store_global 'PhemeCompiler', 'bound_variables', variable_hash
.return( declarations )
}
@@ -347,7 +347,7 @@
.local pmc result
.local pmc symbols
- symbols = find_global 'Pheme::Compiler', 'symbols'
+ symbols = find_global 'PhemeCompiler', 'symbols'
.local string op_name
op_name = node.'op'()
@@ -378,7 +378,7 @@
value = node.'value'()
.local pmc variables
- variables = find_global 'Pheme::Compiler', 'bound_variables'
+ variables = find_global 'PhemeCompiler', 'bound_variables'
.local string value
value = node.'value'()
Modified: trunk/languages/pheme/pheme.pir
==============================================================================
--- trunk/languages/pheme/pheme.pir (original)
+++ trunk/languages/pheme/pheme.pir Tue May 2 12:33:48 2006
@@ -12,6 +12,9 @@
.local string source
source = _get_source( args )
+ .local pmc compile_pheme
+ compile_pheme = find_global 'PhemeCompiler', 'compile_pheme'
+
.local pmc ast
ast = compile_pheme( source )
end