develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r34972 - in branches/pct_hll: compilers/pct/src/PCT languages/pheme languages/pheme/lib

From:
tene
Date:
January 5, 2009 00:58
Subject:
[svn:parrot] r34972 - in branches/pct_hll: compilers/pct/src/PCT languages/pheme languages/pheme/lib
Message ID:
20090105085849.90A12CB9F9@x12.develooper.com
Author: tene
Date: Mon Jan  5 00:58:48 2009
New Revision: 34972

Modified:
   branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir
   branches/pct_hll/languages/pheme/lib/pge2past.tg
   branches/pct_hll/languages/pheme/pheme.pir

Log:
[pheme]: Use the 'pheme' HLL namespace.

Modified: branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir	(original)
+++ branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir	Mon Jan  5 00:58:48 2009
@@ -128,7 +128,7 @@
 
 Accessor for the C<parseactions> attribute.
 
-=item astgrammar([string grammar])
+=item astgrammar([grammar])
 
 Accessor for the C<astgrammar> attribute.
 
@@ -164,7 +164,7 @@
 .end
 
 .sub 'astgrammar' :method
-    .param string value        :optional
+    .param pmc value        :optional
     .param int has_value       :opt_flag
     .tailcall self.'attr'('$astgrammar', value, has_value)
 .end
@@ -428,8 +428,10 @@
     .param pmc adverbs         :slurpy :named
 
   compile_astgrammar:
-    .local string astgrammar_name
+    .local pmc astgrammar_name
     astgrammar_name = self.'astgrammar'()
+    $S0 = typeof astgrammar_name
+    eq $S0, 'NameSpace', astgrammar_ns
     unless astgrammar_name goto compile_match
 
     .local pmc astgrammar_namelist
@@ -439,6 +441,11 @@
     astgrammar = new astgrammar_namelist
     astbuilder = astgrammar.'apply'(source)
     .tailcall astbuilder.'get'('past')
+  astgrammar_ns:
+    $P0 = get_class astgrammar_name
+    astgrammar = new $P0
+    astbuilder = astgrammar.'apply'(source)
+    .tailcall astbuilder.'get'('past')
 
   compile_match:
     #push_eh err_past

Modified: branches/pct_hll/languages/pheme/lib/pge2past.tg
==============================================================================
--- branches/pct_hll/languages/pheme/lib/pge2past.tg	(original)
+++ branches/pct_hll/languages/pheme/lib/pge2past.tg	Mon Jan  5 00:58:48 2009
@@ -4,6 +4,7 @@
     .local pmc result
     result = new ['PAST';'Block']
     result.'namespace'( 'Pheme' )
+    result.'hll'('pheme')
 
     .local pmc lists
     lists = node['pheme_list']

Modified: branches/pct_hll/languages/pheme/pheme.pir
==============================================================================
--- branches/pct_hll/languages/pheme/pheme.pir	(original)
+++ branches/pct_hll/languages/pheme/pheme.pir	Mon Jan  5 00:58:48 2009
@@ -24,6 +24,24 @@
 
 =cut
 
+.HLL 'pheme'
+
+.sub '' :anon :load :init
+    load_bytecode 'PCT.pbc'
+    load_bytecode 'TGE.pbc'
+
+    .local pmc parrotns, hllns, exports
+    parrotns = get_root_namespace ['parrot']
+    hllns = get_hll_namespace
+    exports = split ' ', 'PAST PCT PGE TGE'
+    parrotns.'export_to'(hllns, exports)
+.end
+
+.include 'languages/pheme/lib/PhemeObjects.pir'
+.include 'languages/pheme/lib/PhemeSymbols.pir'
+.include 'languages/pheme/lib/pheme_grammar_gen.pir'
+.include 'languages/pheme/lib/ASTGrammar.pir'
+
 .namespace [ 'Pheme';'Compiler' ]
 
 .sub '__onload' :load :init
@@ -31,9 +49,9 @@
     load_bytecode 'PGE/Text.pbc'
 
     .local pmc p6meta
-    p6meta = get_hll_global 'P6metaclass'
+    p6meta = get_root_global ['parrot'], 'P6metaclass'
 
-    $P0 = p6meta.'new_class'('Match','parent'=>'PGE::Match')
+    $P0 = p6meta.'new_class'('Match','parent'=>'parrot;PGE::Match')
     $P0 = p6meta.'new_class'('Grammar','parent'=>'Match')
     $P0 = p6meta.'new_class'('Pheme::PGE::Grammar','parent'=>'Grammar')
 
@@ -41,8 +59,10 @@
     $P1 = $P0.'new'()
 
     $P1.'language'('Pheme')
-    $P1.'parsegrammar'( 'Pheme::Grammar' )
-    $P1.'astgrammar'(   'Pheme::AST::Grammar' )
+    $P0 = get_hll_namespace ['Pheme';'Grammar']
+    $P1.'parsegrammar'($P0)
+    $P0 = get_hll_namespace ['Pheme';'AST';'Grammar']
+    $P1.'astgrammar'(  $P0)
 .end
 
 =item main(args :slurpy)  :main
@@ -73,11 +93,6 @@
     end
 .end
 
-.include 'languages/pheme/lib/PhemeObjects.pir'
-.include 'languages/pheme/lib/PhemeSymbols.pir'
-.include 'languages/pheme/lib/pheme_grammar_gen.pir'
-.include 'languages/pheme/lib/ASTGrammar.pir'
-
 =back
 
 =cut



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About