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

[svn:parrot] r34956 - in branches/pct_hll: compilers/nqp/src/Grammar compilers/pct/src/PCT compilers/pge/PGE languages/lolcode runtime/parrot/library runtime/parrot/library/PGE

From:
tene
Date:
January 4, 2009 20:36
Subject:
[svn:parrot] r34956 - in branches/pct_hll: compilers/nqp/src/Grammar compilers/pct/src/PCT compilers/pge/PGE languages/lolcode runtime/parrot/library runtime/parrot/library/PGE
Message ID:
20090105043637.6A7BDCB9F9@x12.develooper.com
Author: tene
Date: Sun Jan  4 20:36:36 2009
New Revision: 34956

Modified:
   branches/pct_hll/compilers/nqp/src/Grammar/Actions.pir
   branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir
   branches/pct_hll/compilers/pge/PGE/Match.pir
   branches/pct_hll/languages/lolcode/lolcode.pir
   branches/pct_hll/runtime/parrot/library/P6object.pir
   branches/pct_hll/runtime/parrot/library/PGE/Perl6Grammar.pir

Log:
Assorted updates all over to make things play nicer with HLLs.
Languages can get through compilation... don't actually run yet.

Modified: branches/pct_hll/compilers/nqp/src/Grammar/Actions.pir
==============================================================================
--- branches/pct_hll/compilers/nqp/src/Grammar/Actions.pir	(original)
+++ branches/pct_hll/compilers/nqp/src/Grammar/Actions.pir	Sun Jan  4 20:36:36 2009
@@ -788,7 +788,7 @@
     if $S0 != 'class' goto class_done
     .local string inline
     inline = <<'        INLINE'
-        $P0 = get_hll_global 'P6metaclass'
+        $P0 = get_root_global ['parrot'], 'P6metaclass'
         $P1 = split '::', '%s'
         push_eh subclass_done
         $P2 = $P0.'new_class'($P1)

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	Sun Jan  4 20:36:36 2009
@@ -370,6 +370,8 @@
     ##  if parseactions is a Class or array, make action directly from that
     $I0 = isa parseactions, 'Class'
     if $I0 goto action_make
+    $I0 = isa parseactions, 'NameSpace'
+    if $I0 goto action_namespace
     $I0 = does parseactions, 'array'
     if $I0 goto action_make
     ##  if parseactions is not a String, use it directly.
@@ -377,6 +379,10 @@
     if $I0 goto action_string
     action = parseactions
     goto have_action
+  action_namespace:
+    $P0 = get_class parseactions
+    action = new $P0
+    goto have_action
   action_string:
     ##  Try the string itself, if that fails try splitting on '::'
     $P0 = get_class parseactions

Modified: branches/pct_hll/compilers/pge/PGE/Match.pir
==============================================================================
--- branches/pct_hll/compilers/pge/PGE/Match.pir	(original)
+++ branches/pct_hll/compilers/pge/PGE/Match.pir	Sun Jan  4 20:36:36 2009
@@ -111,12 +111,14 @@
     grammar = adverbs['grammar']
     $S0 = typeof grammar
     eq $S0, 'NameSpace', grammar_namespace
+    ne $S0, 'String', have_grammar
     $S0 = grammar
     $P0 = split '::', $S0
+  have_grammar:
     grammar_class = get_class $P0
     goto with_grammar
   grammar_namespace:
-    grammar_class = grammar
+    grammar_class = get_class grammar
   with_grammar:
   with_adverbs:
 

Modified: branches/pct_hll/languages/lolcode/lolcode.pir
==============================================================================
--- branches/pct_hll/languages/lolcode/lolcode.pir	(original)
+++ branches/pct_hll/languages/lolcode/lolcode.pir	Sun Jan  4 20:36:36 2009
@@ -27,13 +27,21 @@
 
 .loadlib 'lolcode_group'
 
-.sub 'onload' :anon :load :init
+.sub '' :anon :load :init
     load_bytecode 'PCT.pbc'
     .local pmc parrotns, lolns, exports
     parrotns = get_root_namespace ['parrot']
     lolns = get_hll_namespace
-    exports = split ' ', 'PAST PCT'
+    exports = split ' ', 'PAST PCT PGE P6metaclass'
     parrotns.'export_to'(lolns, exports)
+.end
+
+.include 'src/gen_builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/parser/yarn_literal.pir'
+.include 'src/gen_actions.pir'
+
+.sub 'onload' :anon :load :init
 
     $P0 = new 'ResizablePMCArray'
     set_hll_global ['lolcode';'Grammar';'Actions'], '@?BLOCK', $P0
@@ -44,8 +52,14 @@
     $P0 = get_hll_global ['PCT'], 'HLLCompiler'
     $P1 = $P0.'new'()
     $P1.'language'('lolcode')
-    $P1.'parsegrammar'('lolcode::Grammar')
-    $P1.'parseactions'('lolcode::Grammar::Actions')
+    $P0 = get_hll_namespace ['lolcode';'Grammar']
+    $P2 = get_class $P0
+    $P2 = new $P2
+    $P1.'parsegrammar'($P0)
+    $P0 = get_hll_namespace ['lolcode';'Grammar';'Actions']
+    $P2 = get_class $P0
+    $P2 = new $P2
+    $P1.'parseactions'($P0)
 .end
 
 =item main(args :slurpy)  :main
@@ -63,11 +77,6 @@
 .end
 
 
-.include 'src/gen_builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/parser/yarn_literal.pir'
-.include 'src/gen_actions.pir'
-
 =back
 
 =cut

Modified: branches/pct_hll/runtime/parrot/library/P6object.pir
==============================================================================
--- branches/pct_hll/runtime/parrot/library/P6object.pir	(original)
+++ branches/pct_hll/runtime/parrot/library/P6object.pir	Sun Jan  4 20:36:36 2009
@@ -479,18 +479,29 @@
     options['hll'] = hll
   have_hll:
 
+    .local pmc class_ns, ns
+    $S0 = typeof name
     $I0 = isa name, 'String'
     if $I0, parrotclass_string
+    $I0 = isa name, 'ResizableStringArray'
+    if $I0, parrotclass_array
     parrotclass = newclass name
     goto have_parrotclass
   parrotclass_string:
     $S0 = name
-    .local pmc class_ns, ns
     class_ns = split '::', $S0
     unshift class_ns, hll
     $P0 = get_root_namespace
     ns = $P0.'make_namespace'(class_ns)
     parrotclass = newclass ns
+    goto have_parrotclass
+  parrotclass_array:
+    class_ns = name
+    unshift class_ns, hll
+    $P0 = get_root_namespace
+    ns = $P0.'make_namespace'(class_ns)
+    parrotclass = newclass ns
+    goto have_parrotclass
   have_parrotclass:
 
     .local pmc attrlist, iter

Modified: branches/pct_hll/runtime/parrot/library/PGE/Perl6Grammar.pir
==============================================================================
--- branches/pct_hll/runtime/parrot/library/PGE/Perl6Grammar.pir	(original)
+++ branches/pct_hll/runtime/parrot/library/PGE/Perl6Grammar.pir	Sun Jan  4 20:36:36 2009
@@ -185,7 +185,7 @@
           ## namespace %0
           push_eh %2
           .local pmc p6meta
-          p6meta = get_hll_global 'P6metaclass'
+          p6meta = get_root_global ['parrot'], 'P6metaclass'
           p6meta.'new_class'('%0', 'parent'=>'%1')
         %2:
           pop_eh



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