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

[svn:parrot] r34965 - in branches/pct_hll/languages/APL: . src/parser

From:
tene
Date:
January 4, 2009 23:04
Subject:
[svn:parrot] r34965 - in branches/pct_hll/languages/APL: . src/parser
Message ID:
20090105070450.AC9B3CB9F9@x12.develooper.com
Author: tene
Date: Sun Jan  4 23:04:49 2009
New Revision: 34965

Modified:
   branches/pct_hll/languages/APL/APL.pir
   branches/pct_hll/languages/APL/src/parser/actions.pm

Log:
[APL]: Move to an HLL namespace.

Modified: branches/pct_hll/languages/APL/APL.pir
==============================================================================
--- branches/pct_hll/languages/APL/APL.pir	(original)
+++ branches/pct_hll/languages/APL/APL.pir	Sun Jan  4 23:04:49 2009
@@ -21,18 +21,34 @@
 
 =cut
 
-.namespace [ 'APL::Compiler' ]
+.HLL 'apl'
+
+.namespace [ 'APL';'Compiler' ]
 
 .loadlib 'apl_group'
 
-.sub 'onload' :anon :load :init
+.sub '' :anon :load :init
     load_bytecode 'PCT.pbc'
 
+    .local pmc parrotns, aplns, exports
+    parrotns = get_root_namespace ['parrot']
+    aplns = get_hll_namespace
+    exports = split ' ', 'PAST PCT PGE'
+    parrotns.'export_to'(aplns, exports)
+.end
+
+.include 'src/gen_builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/gen_actions.pir'
+
+.sub 'onload' :anon :load :init
     $P0 = get_hll_global ['PCT'], 'HLLCompiler'
     $P1 = $P0.'new'()
     $P1.'language'('APL')
-    $P1.'parsegrammar'('APL::Grammar')
-    $P1.'parseactions'('APL::Grammar::Actions')
+    $P0 = get_hll_namespace ['APL';'Grammar']
+    $P1.'parsegrammar'($P0)
+    $P0 = get_hll_namespace ['APL';'Grammar';'Actions']
+    $P1.'parseactions'($P0)
 
     ##  tell PCT to always generate pmcs for Float constants
     $P0 = get_hll_global ['PAST';'Compiler'], '%valflags'
@@ -54,10 +70,6 @@
 .end
 
 
-.include 'src/gen_builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/gen_actions.pir'
-
 =back
 
 =cut

Modified: branches/pct_hll/languages/APL/src/parser/actions.pm
==============================================================================
--- branches/pct_hll/languages/APL/src/parser/actions.pm	(original)
+++ branches/pct_hll/languages/APL/src/parser/actions.pm	Sun Jan  4 23:04:49 2009
@@ -19,10 +19,12 @@
 
 method TOP($/) {
     my $catchpir := "    get_results '0', $P0\n    $S0 = $P0\n    print $S0\n    exit 1\n";
-    my $past := PAST::Op.new( $( $<statement_list> ),
+    my $past := PAST::Block.new(
+                    PAST::Op.new( $( $<statement_list> ),
                               PAST::Op.new( :inline( $catchpir) ),
                               :pasttype('try'),
-                              :node($/) );
+                              :node($/) ),
+                        :hll('apl') );
     make $past;
 }
 



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