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

[svn:parrot] r35006 - in trunk: compilers/nqp/src/Grammar compilers/pct/src/PCT compilers/pge/PGE languages/APL languages/APL/src/parser languages/APL/tools languages/cardinal languages/cardinal/src/classes languages/cardinal/src/parser languages/lolcode

From:
tene
Date:
January 5, 2009 12:47
Subject:
[svn:parrot] r35006 - in trunk: compilers/nqp/src/Grammar compilers/pct/src/PCT compilers/pge/PGE languages/APL languages/APL/src/parser languages/APL/tools languages/cardinal languages/cardinal/src/classes languages/cardinal/src/parser languages/lolcode
Message ID:
20090105204648.228EECB9F9@x12.develooper.com
Author: tene
Date: Mon Jan  5 12:46:44 2009
New Revision: 35006

Modified:
   trunk/compilers/nqp/src/Grammar/Actions.pir
   trunk/compilers/pct/src/PCT/HLLCompiler.pir
   trunk/compilers/pge/PGE/Match.pir
   trunk/languages/APL/APL.pir
   trunk/languages/APL/src/parser/actions.pm
   trunk/languages/APL/tools/gen_operator_defs.pl
   trunk/languages/cardinal/cardinal.pir
   trunk/languages/cardinal/src/classes/Array.pir
   trunk/languages/cardinal/src/classes/Bool.pir
   trunk/languages/cardinal/src/classes/Continuation.pir
   trunk/languages/cardinal/src/classes/Failure.pir
   trunk/languages/cardinal/src/classes/File.pir
   trunk/languages/cardinal/src/classes/Hash.pir
   trunk/languages/cardinal/src/classes/Integer.pir
   trunk/languages/cardinal/src/classes/Kernel.pir
   trunk/languages/cardinal/src/classes/NilClass.pir
   trunk/languages/cardinal/src/classes/Object.pir
   trunk/languages/cardinal/src/classes/Queue.pir
   trunk/languages/cardinal/src/classes/String.pir
   trunk/languages/cardinal/src/parser/actions.pm
   trunk/languages/lolcode/lolcode.pir
   trunk/languages/lolcode/src/parser/actions.pm
   trunk/languages/perl6/src/builtins/control.pir
   trunk/languages/pheme/lib/pge2past.tg
   trunk/languages/pheme/pheme.pir
   trunk/languages/pipp/pipp.pir
   trunk/languages/pipp/src/pct/actions.pm
   trunk/languages/pynie/pynie.pir
   trunk/languages/pynie/src/parser/Actions.pm
   trunk/runtime/parrot/library/P6object.pir
   trunk/runtime/parrot/library/PGE/Perl6Grammar.pir

Log:
Partially erge pct_hll branch into trunk.
I'm *mostly* sure this doesn't break anything.

Modified: trunk/compilers/nqp/src/Grammar/Actions.pir
==============================================================================
--- trunk/compilers/nqp/src/Grammar/Actions.pir	(original)
+++ trunk/compilers/nqp/src/Grammar/Actions.pir	Mon Jan  5 12:46:44 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: trunk/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/HLLCompiler.pir	(original)
+++ trunk/compilers/pct/src/PCT/HLLCompiler.pir	Mon Jan  5 12:46:44 2009
@@ -128,7 +128,7 @@
 
 Accessor for the C<parseactions> attribute.
 
-=item astgrammar([string grammar])
+=item astgrammar([grammar])
 
 Accessor for the C<astgrammar> attribute.
 
@@ -152,7 +152,7 @@
 .end
 
 .sub 'parsegrammar' :method
-    .param string value        :optional
+    .param pmc value        :optional
     .param int has_value       :opt_flag
     .tailcall self.'attr'('$parsegrammar', value, has_value)
 .end
@@ -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
@@ -342,17 +342,23 @@
     top = find_method parsegrammar, 'TOP'
     goto have_top
   parsegrammar_string:
+    $S0 = typeof parsegrammar
+    eq $S0, 'NameSpace', parsegrammar_ns
     $P0 = self.'parse_name'(parsegrammar)
     $S0 = pop $P0
     $P1 = get_hll_global $P0, $S0
     $I0 = can $P1, 'TOP'
-    unless $I0 goto parsegrammar_ns
+    unless $I0 goto parsegrammar_ns_string
     top = find_method $P1, 'TOP'
     goto have_top
-  parsegrammar_ns:
+  parsegrammar_ns_string:
     $P0 = self.'parse_name'(parsegrammar)
     top = get_hll_global $P0, 'TOP'
     unless null top goto have_top
+    goto err_notop
+  parsegrammar_ns:
+    top = parsegrammar['TOP']
+    unless null top goto have_top
   err_notop:
     self.'panic'('Cannot find TOP regex in ', parsegrammar)
   have_top:
@@ -364,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.
@@ -371,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
@@ -416,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
@@ -427,12 +441,17 @@
     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
+    #push_eh err_past
     .local pmc ast
     ast = source.'item'()
-    pop_eh
+    #pop_eh
     $I0 = isa ast, ['PAST';'Node']
     unless $I0 goto err_past
     .return (ast)

Modified: trunk/compilers/pge/PGE/Match.pir
==============================================================================
--- trunk/compilers/pge/PGE/Match.pir	(original)
+++ trunk/compilers/pge/PGE/Match.pir	Mon Jan  5 12:46:44 2009
@@ -111,12 +111,15 @@
     grammar = adverbs['grammar']
     $S0 = typeof grammar
     eq $S0, 'NameSpace', grammar_namespace
+    ne $S0, 'String', have_grammar
     $S0 = grammar
     $P0 = split '::', $S0
     grammar_class = get_class $P0
     goto with_grammar
-  grammar_namespace:
+  have_grammar:
     grammar_class = grammar
+  grammar_namespace:
+    grammar_class = get_class grammar
   with_grammar:
   with_adverbs:
 

Modified: trunk/languages/APL/APL.pir
==============================================================================
--- trunk/languages/APL/APL.pir	(original)
+++ trunk/languages/APL/APL.pir	Mon Jan  5 12:46:44 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: trunk/languages/APL/src/parser/actions.pm
==============================================================================
--- trunk/languages/APL/src/parser/actions.pm	(original)
+++ trunk/languages/APL/src/parser/actions.pm	Mon Jan  5 12:46:44 2009
@@ -18,11 +18,13 @@
 class APL::Grammar::Actions;
 
 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 $catchpir := "    get_results '0', $P0\n    $S0 = $P0\n    print $S0\n    .return ($P0)\n";
+    my $past := PAST::Block.new(
+                    PAST::Op.new( $( $<statement_list> ),
                               PAST::Op.new( :inline( $catchpir) ),
                               :pasttype('try'),
-                              :node($/) );
+                              :node($/) ),
+                        :hll('apl') );
     make $past;
 }
 

Modified: trunk/languages/APL/tools/gen_operator_defs.pl
==============================================================================
--- trunk/languages/APL/tools/gen_operator_defs.pl	(original)
+++ trunk/languages/APL/tools/gen_operator_defs.pl	Mon Jan  5 12:46:44 2009
@@ -280,6 +280,7 @@
 
     $S0 = aplformat(arg)
     say $S0
+    .return (arg)
 .end
 
 .sub 'aplvector'

Modified: trunk/languages/cardinal/cardinal.pir
==============================================================================
--- trunk/languages/cardinal/cardinal.pir	(original)
+++ trunk/languages/cardinal/cardinal.pir	Mon Jan  5 12:46:44 2009
@@ -22,21 +22,29 @@
 =cut
 
 
+.HLL 'cardinal'
 .namespace []
 
 .include 'src/gen_builtins.pir'
 
 .sub 'onload' :anon :load :init
-    $P0 = subclass 'ResizablePMCArray', 'List'
+    load_bytecode 'PCT.pbc'
+    .local pmc parrotns, cardinalns, exports
+    parrotns = get_root_namespace ['parrot']
+    cardinalns = get_hll_namespace
+    exports = split ' ', 'PAST PCT PGE P6metaclass'
+    parrotns.'export_to'(cardinalns, exports)
 .end
 
+.include 'src/gen_grammar.pir'
+.include 'src/parser/quote_expression.pir'
+.include 'src/gen_actions.pir'
 .namespace [ 'cardinal';'Compiler' ]
 
 #no caridinal_group found on my machine
 #.loadlib 'cardinal_group'
 
 .sub 'onload' :anon :load :init
-    load_bytecode 'PCT.pbc'
     .local pmc cardinalmeta
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
     cardinalmeta.'new_class'('cardinal::Compiler', 'parent'=>'PCT::HLLCompiler')
@@ -44,17 +52,19 @@
     $P0 = get_hll_global ['PCT'], 'HLLCompiler'
     $P1 = $P0.'new'()
     $P1.'language'('cardinal')
-    $P1.'parsegrammar'('cardinal::Grammar')
-    $P1.'parseactions'('cardinal::Grammar::Actions')
+    $P0 = get_hll_namespace ['cardinal';'Grammar']
+    $P1.'parsegrammar'($P0)
+    $P0 = get_hll_namespace ['cardinal';'Grammar';'Actions']
+    $P1.'parseactions'($P0)
 
     $P1.'commandline_banner'("Cardinal - Ruby for the Parrot VM\n\n")
     $P1.'commandline_prompt'('crb(main):001:0>')
 
      ##  create a list of END blocks to be run
-    $P0 = new 'List'
+    $P0 = new 'CardinalArray'
     set_hll_global ['cardinal'], '@?END_BLOCKS', $P0
 
-    $P0 = new 'List'
+    $P0 = new 'CardinalArray'
     set_hll_global ['cardinal';'Grammar';'Actions'], '@?BLOCK', $P0
 
     $P1 = get_hll_global ['PAST';'Compiler'], '%valflags'
@@ -99,13 +109,6 @@
   iter_end:
 .end
 
-
-.include 'src/gen_grammar.pir'
-.include 'src/parser/quote_expression.pir'
-.include 'src/gen_actions.pir'
-
-
-
 =back
 
 =cut

Modified: trunk/languages/cardinal/src/classes/Array.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Array.pir	(original)
+++ trunk/languages/cardinal/src/classes/Array.pir	Mon Jan  5 12:46:44 2009
@@ -16,8 +16,8 @@
 .sub 'onload' :anon :load :init
     .local pmc cardinalmeta, arrayproto, interp, core_type, hll_type
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    arrayproto = cardinalmeta.'new_class'('CardinalArray', 'parent'=>'ResizablePMCArray CardinalObject')
-    cardinalmeta.'register'('ResizablePMCArray', 'parent'=>'CardinalObject', 'protoobject'=>arrayproto)
+    arrayproto = cardinalmeta.'new_class'('CardinalArray', 'parent'=>'parrot;ResizablePMCArray CardinalObject')
+    #cardinalmeta.'register'('ResizablePMCArray', 'parent'=>'CardinalObject', 'protoobject'=>arrayproto)
     core_type = get_class 'ResizablePMCArray'
     hll_type = get_class 'CardinalArray'
 

Modified: trunk/languages/cardinal/src/classes/Bool.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Bool.pir	(original)
+++ trunk/languages/cardinal/src/classes/Bool.pir	Mon Jan  5 12:46:44 2009
@@ -17,7 +17,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta, boolproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    boolproto = cardinalmeta.'new_class'('Bool', 'parent'=>'Boolean')
+    boolproto = cardinalmeta.'new_class'('Bool', 'parent'=>'parrot;Boolean')
     cardinalmeta.'register'('Boolean', 'parent'=>boolproto, 'protoobject'=>boolproto)
 
     $P0 = boolproto.'new'()

Modified: trunk/languages/cardinal/src/classes/Continuation.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Continuation.pir	(original)
+++ trunk/languages/cardinal/src/classes/Continuation.pir	Mon Jan  5 12:46:44 2009
@@ -22,7 +22,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta, contproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    contproto = cardinalmeta.'new_class'('CardinalContinuation', 'parent'=>'Continuation CardinalObject')
+    contproto = cardinalmeta.'new_class'('CardinalContinuation', 'parent'=>'parrot;Continuation CardinalObject')
     cardinalmeta.'register'('Continuation', 'parent'=>'CardinalObject', 'protoobject'=>contproto)
 
 .end

Modified: trunk/languages/cardinal/src/classes/Failure.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Failure.pir	(original)
+++ trunk/languages/cardinal/src/classes/Failure.pir	Mon Jan  5 12:46:44 2009
@@ -3,7 +3,7 @@
 .sub 'onload' :anon :init :load
     .local pmc meta, failureproto, exceptionproto
     meta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    failureproto = meta.'new_class'('CardinalFailure', 'parent'=>'Undef CardinalAny', 'attr'=>'$!exception')
+    failureproto = meta.'new_class'('CardinalFailure', 'parent'=>'parrot;Undef CardinalAny', 'attr'=>'$!exception')
     meta.'register'('Undef', 'parent'=>failureproto, 'protoobject'=>failureproto)
     exceptionproto = meta.'new_class'('CardinalException', 'parent'=>'CardinalAny', 'attr'=>'$!exception')
     meta.'register'('Exception', 'protoobject'=>exceptionproto)

Modified: trunk/languages/cardinal/src/classes/File.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/File.pir	(original)
+++ trunk/languages/cardinal/src/classes/File.pir	Mon Jan  5 12:46:44 2009
@@ -22,7 +22,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta
     $P0 = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    cardinalmeta = $P0.'new_class'('CardinalFile', 'parent'=>'File IO CardinalObject', 'attr'=>'!path')
+    cardinalmeta = $P0.'new_class'('CardinalFile', 'parent'=>'parrot;File IO CardinalObject', 'attr'=>'!path')
     $P0.'register'('File', 'parent'=>'CardinalObject', 'protoobject'=>cardinalmeta)
 .end
 

Modified: trunk/languages/cardinal/src/classes/Hash.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Hash.pir	(original)
+++ trunk/languages/cardinal/src/classes/Hash.pir	Mon Jan  5 12:46:44 2009
@@ -15,7 +15,7 @@
 .sub 'onload' :anon :load :init
     .local pmc cardinalmeta, mappingproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    mappingproto = cardinalmeta.'new_class'('CardinalHash', 'parent'=>'Hash CardinalObject')
+    mappingproto = cardinalmeta.'new_class'('CardinalHash', 'parent'=>'parrot;Hash CardinalObject')
     cardinalmeta.'register'('Hash', 'parent'=>'CardinalObject', 'protoobject'=>mappingproto)
     $P0 = get_class 'CardinalHash'
     addattribute $P0, 'default'
@@ -76,7 +76,7 @@
     .local pmc iter
     .local pmc rv
     iter = new 'Iterator', self
-    rv   = new 'List'
+    rv   = new 'CardinalArray'
   loop:
     unless iter goto end
     $S1 = shift iter
@@ -94,7 +94,7 @@
     .local pmc iter
     .local pmc rv
     iter = new 'Iterator', self
-    rv   = new 'List'
+    rv   = new 'CardinalArray'
   loop:
     unless iter goto end
     $S1 = shift iter
@@ -109,7 +109,7 @@
     .local pmc iter
     .local pmc rv
     iter = new 'Iterator', self
-    rv   = new 'List'
+    rv   = new 'CardinalArray'
   loop:
     unless iter goto end
     $S1 = shift iter

Modified: trunk/languages/cardinal/src/classes/Integer.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Integer.pir	(original)
+++ trunk/languages/cardinal/src/classes/Integer.pir	Mon Jan  5 12:46:44 2009
@@ -20,7 +20,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta, intproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    intproto = cardinalmeta.'new_class'('CardinalInteger', 'parent'=>'Integer CardinalObject')
+    intproto = cardinalmeta.'new_class'('CardinalInteger', 'parent'=>'parrot;Integer CardinalObject')
     cardinalmeta.'register'('Float', 'parent'=>'CardinalObject', 'protoobject'=>intproto)
 .end
 

Modified: trunk/languages/cardinal/src/classes/Kernel.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Kernel.pir	(original)
+++ trunk/languages/cardinal/src/classes/Kernel.pir	Mon Jan  5 12:46:44 2009
@@ -21,7 +21,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta, kernelprototype
     load_bytecode 'P6object.pbc'
-    $P0 = get_hll_global 'P6metaclass'
+    $P0 = get_hll_global ['CardinalObject'], '!CARDINALMETA'
     kernelprototype = $P0.'new_class'('Kernel', 'attr'=>'%!properties')
     #cardinalmeta = $P0.'HOW'()
     cardinalmeta = kernelprototype.'new'()

Modified: trunk/languages/cardinal/src/classes/NilClass.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/NilClass.pir	(original)
+++ trunk/languages/cardinal/src/classes/NilClass.pir	Mon Jan  5 12:46:44 2009
@@ -5,7 +5,7 @@
 .sub 'onload' :anon :load :init
     .local pmc cardinalmeta, nilproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    nilproto = cardinalmeta.'new_class'('NilClass', 'parent'=>'Undef CardinalObject')
+    nilproto = cardinalmeta.'new_class'('NilClass', 'parent'=>'parrot;Undef CardinalObject')
     cardinalmeta.'register'('Undef', 'parent'=>nilproto, 'protoobject'=>nilproto)
 .end
 

Modified: trunk/languages/cardinal/src/classes/Object.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Object.pir	(original)
+++ trunk/languages/cardinal/src/classes/Object.pir	Mon Jan  5 12:46:44 2009
@@ -29,7 +29,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta
     load_bytecode 'P6object.pbc'
-    $P0 = get_hll_global 'P6metaclass'
+    $P0 = get_root_global ['parrot'], 'P6metaclass'
     $P0.'new_class'('CardinalObject', 'attr'=>'%!properties')
     cardinalmeta = $P0.'HOW'()
     set_hll_global ['CardinalObject'], '!CARDINALMETA', cardinalmeta

Modified: trunk/languages/cardinal/src/classes/Queue.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/Queue.pir	(original)
+++ trunk/languages/cardinal/src/classes/Queue.pir	Mon Jan  5 12:46:44 2009
@@ -22,7 +22,7 @@
 .sub 'onload' :anon :init :load
     .local pmc meta, qproto
     meta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    qproto = meta.'new_class'('Queue', 'parent'=>'TQueue CardinalObject', 'attr'=>'')
+    qproto = meta.'new_class'('Queue', 'parent'=>'parrot;TQueue CardinalObject', 'attr'=>'')
     meta.'register'('TQueue', 'parent'=>'TQueue', 'protoobject'=>qproto)
 .end
 

Modified: trunk/languages/cardinal/src/classes/String.pir
==============================================================================
--- trunk/languages/cardinal/src/classes/String.pir	(original)
+++ trunk/languages/cardinal/src/classes/String.pir	Mon Jan  5 12:46:44 2009
@@ -23,7 +23,7 @@
 .sub 'onload' :anon :init :load
     .local pmc cardinalmeta, strproto
     cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
-    strproto = cardinalmeta.'new_class'('CardinalString', 'parent'=>'String CardinalObject')
+    strproto = cardinalmeta.'new_class'('CardinalString', 'parent'=>'parrot;String CardinalObject')
     cardinalmeta.'register'('String', 'parent'=>'CardinalObject', 'protoobject'=>strproto)
 .end
 

Modified: trunk/languages/cardinal/src/parser/actions.pm
==============================================================================
--- trunk/languages/cardinal/src/parser/actions.pm	(original)
+++ trunk/languages/cardinal/src/parser/actions.pm	Mon Jan  5 12:46:44 2009
@@ -21,6 +21,7 @@
     my $past := $( $<comp_stmt> );
     $past.blocktype('declaration');
     $past.pirflags(':load');
+    $past.hll('cardinal');
 
     our $?INIT;
         if defined( $?INIT ) {

Modified: trunk/languages/lolcode/lolcode.pir
==============================================================================
--- trunk/languages/lolcode/lolcode.pir	(original)
+++ trunk/languages/lolcode/lolcode.pir	Mon Jan  5 12:46:44 2009
@@ -21,12 +21,27 @@
 
 =cut
 
+.HLL 'lolcode'
+
 .namespace [ 'lolcode';'Compiler' ]
 
 .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 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
@@ -37,8 +52,10 @@
     $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']
+    $P1.'parsegrammar'($P0)
+    $P0 = get_hll_namespace ['lolcode';'Grammar';'Actions']
+    $P1.'parseactions'($P0)
 .end
 
 =item main(args :slurpy)  :main
@@ -56,11 +73,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: trunk/languages/lolcode/src/parser/actions.pm
==============================================================================
--- trunk/languages/lolcode/src/parser/actions.pm	(original)
+++ trunk/languages/lolcode/src/parser/actions.pm	Mon Jan  5 12:46:44 2009
@@ -22,6 +22,7 @@
     $block.symbol('IT', :scope('lexical'));
     my $it := PAST::Var.new( :name( 'IT' ), :scope('lexical'), :viviself('Undef'), :isdecl(1));
     $block.unshift($it);
+    $block.hll('lolcode');
     make $block;
 }
 

Modified: trunk/languages/perl6/src/builtins/control.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/control.pir	(original)
+++ trunk/languages/perl6/src/builtins/control.pir	Mon Jan  5 12:46:44 2009
@@ -301,14 +301,24 @@
     $P0 = get_hll_global 'Str'
     '!TYPECHECKPARAM'($P0, code)
 
-    unless have_lang goto no_lang
-    'die'('Lanuage parameter to eval unimplemented.')
-  no_lang:
-
     .local pmc compiler, invokable
     .local pmc res, exception
+    unless have_lang goto no_lang
+    push_eh catch
+    $S0 = lang
+    $S0 = concat 'languages/', $S0
+    $S0 = concat $S0, '/'
+    $S1 = lang
+    $S0 = concat $S0, $S1
+    $S0 = concat $S0, '.pbc'
+    load_bytecode $S0
+    $S0 = lang
+    compiler = compreg $S0
+    goto got_lang
+  no_lang:
     push_eh catch
     compiler = compreg 'Perl6'
+  got_lang:
     invokable = compiler.'compile'(code)
 
     res = invokable()

Modified: trunk/languages/pheme/lib/pge2past.tg
==============================================================================
--- trunk/languages/pheme/lib/pge2past.tg	(original)
+++ trunk/languages/pheme/lib/pge2past.tg	Mon Jan  5 12:46:44 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: trunk/languages/pheme/pheme.pir
==============================================================================
--- trunk/languages/pheme/pheme.pir	(original)
+++ trunk/languages/pheme/pheme.pir	Mon Jan  5 12:46:44 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,18 +49,20 @@
     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')
 
     $P0 = get_hll_global ['PCT'], 'HLLCompiler'
     $P1 = $P0.'new'()
 
-    $P1.'language'('Pheme')
-    $P1.'parsegrammar'( 'Pheme::Grammar' )
-    $P1.'astgrammar'(   'Pheme::AST::Grammar' )
+    $P1.'language'('pheme')
+    $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
@@ -54,7 +74,7 @@
 .sub 'main' :anon :main
     .param pmc args
 
-    $P0 = compreg 'Pheme'
+    $P0 = compreg 'pheme'
 
     .include 'except_severity.pasm'
     .local pmc eh
@@ -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

Modified: trunk/languages/pipp/pipp.pir
==============================================================================
--- trunk/languages/pipp/pipp.pir	(original)
+++ trunk/languages/pipp/pipp.pir	Mon Jan  5 12:46:44 2009
@@ -28,15 +28,31 @@
 
 =cut
 
+.HLL 'pipp'
+
+.sub '' :anon :load :init
+
+    # Pipp uses the Parrot Compiler Toolkit
+    load_bytecode 'PCT.pbc'
+
+    # Export namespaces to the appropriate HLL ns
+    .local pmc parrotns, phpns, exports
+    parrotns = get_root_namespace ['parrot']
+    phpns = get_hll_namespace
+    exports = split ' ', 'PAST PCT PGE'
+    parrotns.'export_to'(phpns, exports)
+.end
+
+.include 'src/pct/gen_grammar.pir'
+.include 'src/pct/gen_actions.pir'
+.include 'src/pct/quote_expression.pir'
+
 .HLL '_pipp'
 
 .const string VERSION = "0.0.1"
 
 .sub '__onload' :anon :load :init
 
-    # Pipp uses the Parrot Compiler Toolkit
-    load_bytecode 'PCT.pbc'
-
     # %valflags specifies when PAST::Val nodes are allowed to
     # be used as a constant.  The 'e' flag indicates that the
     # value must be quoted+escaped in PIR code.
@@ -77,13 +93,15 @@
 
     # Initialize the stack @?BLOCK
     $P0 = new 'ResizablePMCArray'
-    set_root_global ['parrot';'Pipp';'Grammar';'Actions'], '@?BLOCK', $P0
+    set_root_global ['pipp';'Pipp';'Grammar';'Actions'], '@?BLOCK', $P0
 
     # register and set up the the HLLCompiler
     $P1 = new ['PCT';'HLLCompiler']
     $P1.'language'('Pipp')
-    $P1.'parsegrammar'('Pipp::Grammar')
-    $P1.'parseactions'('Pipp::Grammar::Actions')
+    $P0 = get_root_namespace ['pipp';'Pipp';'Grammar']
+    $P1.'parsegrammar'($P0)
+    $P0 = get_root_namespace ['pipp';'Pipp';'Grammar';'Actions']
+    $P1.'parseactions'($P0)
 
 .end
 
@@ -342,12 +360,6 @@
 
 .end
 
-.HLL 'parrot'
-
-.include 'src/pct/gen_grammar.pir'
-.include 'src/pct/gen_actions.pir'
-.include 'src/pct/quote_expression.pir'
-
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm	(original)
+++ trunk/languages/pipp/src/pct/actions.pm	Mon Jan  5 12:46:44 2009
@@ -48,6 +48,8 @@
             $block.push( $($_) );
         }
 
+        $block.hll('pipp');
+
         make $block;
     }
 }

Modified: trunk/languages/pynie/pynie.pir
==============================================================================
--- trunk/languages/pynie/pynie.pir	(original)
+++ trunk/languages/pynie/pynie.pir	Mon Jan  5 12:46:44 2009
@@ -18,14 +18,36 @@
 
 =cut
 
-.sub '__onload' :load :init
+.HLL 'pynie'
+
+.sub '' :anon :load :init
     load_bytecode 'PCT.pbc'
 
+    .local pmc parrotns, pyns, exports
+    parrotns = get_root_namespace ['parrot']
+    pyns = get_hll_namespace
+    exports = split ' ', 'PAST PCT PGE'
+    parrotns.'export_to'(pyns, exports)
+.end
+
+.include 'src/gen_grammar.pir'
+.include 'src/gen_actions.pir'
+.include 'src/parser/indent.pir'
+
+.include 'src/builtins/funcs.pir'
+.include 'src/builtins/io.pir'
+.include 'src/builtins/lists.pir'
+.include 'src/builtins/oper.pir'
+
+
+.sub '__onload' :load :init
     $P0 = get_hll_global ['PCT'], 'HLLCompiler'
     $P0 = $P0.'new'()
     $P0.'language'('Pynie')
-    $P0.'parsegrammar'('Pynie::Grammar')
-    $P0.'parseactions'('Pynie::Grammar::Actions')
+    $P1 = get_hll_namespace ['Pynie';'Grammar']
+    $P0.'parsegrammar'($P1)
+    $P1 = get_hll_namespace ['Pynie';'Grammar';'Actions']
+    $P0.'parseactions'($P1)
 
     $P0.'commandline_banner'("Pynie: a Python compiler for Parrot.\n")
     $P0.'commandline_prompt'('>>> ')
@@ -48,15 +70,6 @@
 .end
 
 
-.include 'src/gen_grammar.pir'
-.include 'src/gen_actions.pir'
-.include 'src/parser/indent.pir'
-
-.include 'src/builtins/funcs.pir'
-.include 'src/builtins/io.pir'
-.include 'src/builtins/lists.pir'
-.include 'src/builtins/oper.pir'
-
 =back
 
 =cut

Modified: trunk/languages/pynie/src/parser/Actions.pm
==============================================================================
--- trunk/languages/pynie/src/parser/Actions.pm	(original)
+++ trunk/languages/pynie/src/parser/Actions.pm	Mon Jan  5 12:46:44 2009
@@ -4,7 +4,9 @@
 class Pynie::Grammar::Actions;
 
 method TOP($/) {
-    make $( $<file_input> );
+    my $block := PAST::Block.new( $( $<file_input> ) );
+    $block.hll('pynie');
+    make $block;
 }
 
 method file_input($/) {

Modified: trunk/runtime/parrot/library/P6object.pir
==============================================================================
--- trunk/runtime/parrot/library/P6object.pir	(original)
+++ trunk/runtime/parrot/library/P6object.pir	Mon Jan  5 12:46:44 2009
@@ -287,6 +287,8 @@
 
 =cut
 
+.include 'library/dumper.pir'
+
 .sub 'register' :method
     .param pmc parrotclass
     .param pmc options         :slurpy :named
@@ -300,7 +302,7 @@
     ## get the hll, either from options or the caller's namespace
     .local pmc hll
     hll = options['hll']
-    $I0 = defined $P0
+    $I0 = defined hll
     if $I0, have_hll
     $P0 = getinterp
     $P0 = $P0['namespace';1]
@@ -326,13 +328,27 @@
     $S0 = parentclass
     parentclass = split ' ', $S0
   parent_array:
-    .local pmc iter
+    .local pmc iter, item
     iter = new 'Iterator', parentclass
   parent_loop:
     unless iter goto parent_done
-    $P0 = shift iter
-    unless $P0 goto parent_loop
-    self.'add_parent'($P0, 'to'=>parrotclass)
+    item = shift iter
+    $S0 = item
+    $P0 = split ';', $S0
+    $I0 = elements $P0
+    eq $I0, 1, no_parent_hll
+    $S0 = shift $P0
+    goto have_parent_hll
+  no_parent_hll:
+    $S0 = hll
+  have_parent_hll:
+    $P0 = shift $P0
+    $S1 = $P0
+    $P0 = split '::', $S1
+    unshift $P0, $S0
+    $S0 = pop $P0
+    item = get_root_global $P0, $S0
+    self.'add_parent'(item, 'to'=>parrotclass)
     goto parent_loop
   parent_done:
     self.'add_parent'('P6object', 'to'=>parrotclass)
@@ -463,27 +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, lookup
     class_ns = split '::', $S0
     unshift class_ns, hll
-    lookup = get_root_namespace class_ns
-    $I0 = defined lookup
-    unless $I0, parrotclass_no_namespace
-    parrotclass = newclass lookup
+    $P0 = get_root_namespace
+    ns = $P0.'make_namespace'(class_ns)
+    parrotclass = newclass ns
     goto have_parrotclass
-  parrotclass_no_namespace:
-    # The namespace doesn't exist, so we need to create it
-    .local pmc ns
-    ns = new 'NameSpace'
-    set_root_global class_ns, '', ns
-    ns = get_root_namespace class_ns
+  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
@@ -537,6 +555,9 @@
 
 .sub 'get_parrotclass' :method
     .param pmc x
+    .param pmc hll :named('hll') :optional
+    .param int has_hll :opt_flag
+    if null x goto done
     .local pmc parrotclass
     parrotclass = x
     $S0 = typeof x
@@ -544,6 +565,8 @@
     if $S0 == 'PMCProxy' goto done
     $I0 = isa x, 'String'
     if $I0 goto x_string
+    $I0 = isa x, 'NameSpace'
+    if $I0 goto x_ns
     $I0 = isa x, 'P6object'
     if $I0 goto x_p6object
     $P0 = typeof x
@@ -559,6 +582,12 @@
     unless null parrotclass goto done
     $S0 = x
     $P0 = split '::', $S0
+    unless has_hll goto no_hll
+    unshift $P0, hll
+    x = get_root_namespace $P0
+    unless null x goto x_ns
+    $S0 = shift $P0
+  no_hll:
     x = get_hll_namespace $P0
   x_ns:
     if null x goto done

Modified: trunk/runtime/parrot/library/PGE/Perl6Grammar.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Perl6Grammar.pir	(original)
+++ trunk/runtime/parrot/library/PGE/Perl6Grammar.pir	Mon Jan  5 12:46:44 2009
@@ -184,7 +184,7 @@
     initpir.'emit'(<<'        CODE', namespace, inherit, $S0)
           ## namespace %0
           .local pmc p6meta
-          p6meta = get_hll_global 'P6metaclass'
+          p6meta = get_root_global ['parrot'], 'P6metaclass'
           $P0 = p6meta.'get_proto'('%0')
           unless null $P0 goto %2
           p6meta.'new_class'('%0', 'parent'=>'%1')



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