Author: tene
Date: Sun Jan 4 20:36:23 2009
New Revision: 34955
Modified:
branches/pct_hll/compilers/pct/src/PCT/HLLCompiler.pir
branches/pct_hll/languages/perl6/perl6.pir
branches/pct_hll/languages/perl6/src/classes/Hash.pir
Log:
[pct]: Accept a namespace for parsegrammar in HLLCompiler
[rakudo]
* Use a namespace for parsegrammar and parseactions
* Add a workaround for a scary crash
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:23 2009
@@ -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
@@ -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:
Modified: branches/pct_hll/languages/perl6/perl6.pir
==============================================================================
--- branches/pct_hll/languages/perl6/perl6.pir (original)
+++ branches/pct_hll/languages/perl6/perl6.pir Sun Jan 4 20:36:23 2009
@@ -31,15 +31,23 @@
.sub 'onload' :load :init :anon
load_bytecode 'PCT.pbc'
+ .local pmc parrotns, hllns, exports
+ parrotns = get_root_namespace ['parrot']
+ hllns = get_hll_namespace
+ exports = split ' ', 'PGE PAST'
+ parrotns.'export_to'(hllns, exports)
+
.local pmc p6meta, perl6
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
- perl6 = p6meta.'new_class'('Perl6::Compiler', 'parent'=>'PCT::HLLCompiler')
+ perl6 = p6meta.'new_class'('Perl6::Compiler',
'parent'=>'parrot;PCT::HLLCompiler')
load_bytecode 'config.pbc'
perl6.'language'('Perl6')
- perl6.'parsegrammar'('Perl6::Grammar')
- perl6.'parseactions'('Perl6::Grammar::Actions')
+ $P0 = get_hll_namespace ['Perl6';'Grammar']
+ perl6.'parsegrammar'($P0)
+ $P0 = get_hll_namespace ['Perl6';'Grammar';'Action']
+ perl6.'parseactions'($P0)
## set the compilation stages in the @stages attribute
$P0 = split ' ', 'parse past check_syntax post pir evalpmc'
@@ -121,7 +129,7 @@
set_hll_global ['Perl6'], '@?END_BLOCKS', $P0
## tell PAST::Var how to encode Perl6Str and Str values
- $P0 = get_hll_global ['PAST';'Compiler'], '%valflags'
+ $P0 = get_root_global ['parrot';'PAST';'Compiler'], '%valflags'
$P0['Perl6Str'] = 'e'
$P0['Str'] = 'e'
.end
Modified: branches/pct_hll/languages/perl6/src/classes/Hash.pir
==============================================================================
--- branches/pct_hll/languages/perl6/src/classes/Hash.pir (original)
+++ branches/pct_hll/languages/perl6/src/classes/Hash.pir Sun Jan 4
20:36:23 2009
@@ -10,7 +10,8 @@
.sub 'onload' :anon :load :init
.local pmc p6meta, hashproto
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
- hashproto = p6meta.'new_class'('Perl6Hash', 'parent'=>'Mapping',
'name'=>'Hash')
+ # work-around for scary crash
+ hashproto = p6meta.'new_class'('Perl6Hash', 'parent'=>'Mapping')#,
'name'=>'Hash')
hashproto.'!MUTABLE'()
.end