Skip to content

Commit

Permalink
Merge hllmagic branch into trunk.
Browse files Browse the repository at this point in the history
Mostly looks okay.
If anyone runs into problems fixing the last few issues with their languages, address issues to Tene or pmichaud.


git-svn-id: https://svn.parrot.org/parrot/trunk@31862 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
tene committed Oct 10, 2008
1 parent 628a39a commit 1ebf2db
Show file tree
Hide file tree
Showing 91 changed files with 1,152 additions and 859 deletions.
2 changes: 1 addition & 1 deletion compilers/nqp/bootstrap/actions.pm
Expand Up @@ -747,7 +747,7 @@ method package_declarator($/, $key) {
#if ($<sym> eq 'class') { ...code to make class... } #if ($<sym> eq 'class') { ...code to make class... }
make $past; make $past;
# PIR q< $P0 = get_hll_global ['NQP::Grammar::Actions'], 'package_declarator_helper' >; # PIR q< $P0 = get_hll_global ['NQP';'Grammar';'Actions'], 'package_declarator_helper' >;
# PIR q< $P1 = find_lex '$/' >; # PIR q< $P1 = find_lex '$/' >;
# PIR q< $P2 = find_lex '$key' >; # PIR q< $P2 = find_lex '$key' >;
# PIR q< $P0($P1, $P2) >; # PIR q< $P0($P1, $P2) >;
Expand Down
6 changes: 3 additions & 3 deletions compilers/nqp/bootstrap/nqp.pir
Expand Up @@ -21,7 +21,7 @@ object.


=cut =cut


.namespace [ 'NQP::Compiler' ] .namespace [ 'NQP';'Compiler' ]


.loadlib 'nqp_group' .loadlib 'nqp_group'


Expand Down Expand Up @@ -81,7 +81,7 @@ to the nqp compiler.
.end .end
#.namespace [ 'NQP::Grammar::Actions' ] #.namespace [ 'NQP';'Grammar';'Actions' ]
# #
#.sub 'package_declarator_helper' #.sub 'package_declarator_helper'
# .param pmc match # .param pmc match
Expand Down Expand Up @@ -123,7 +123,7 @@ to the nqp compiler.
## initialize optable with inline PIR ## initialize optable with inline PIR
.local pmc optable .local pmc optable
optable = get_hll_global [ 'NQP::Grammar' ], '$optable' optable = get_hll_global [ 'NQP';'Grammar' ], '$optable'
optable['prefix:~'; 'inline'] = <<" END" optable['prefix:~'; 'inline'] = <<" END"
## inline prefix:~ ## inline prefix:~
$S0 = %0 $S0 = %0
Expand Down
6 changes: 3 additions & 3 deletions compilers/nqp/nqp.pir
@@ -1,19 +1,19 @@
# Copyright (C) 2007-2008, The Perl Foundation. # Copyright (C) 2007-2008, The Perl Foundation.
# $Id$ # $Id$


.namespace [ 'NQP::Compiler' ] .namespace [ 'NQP';'Compiler' ]


.sub '__onload' :load :init .sub '__onload' :load :init
load_bytecode 'PGE.pbc' load_bytecode 'PGE.pbc'
load_bytecode 'PCT.pbc' load_bytecode 'PCT.pbc'


$P0 = new [ 'PCT::HLLCompiler' ] $P0 = new [ 'PCT';'HLLCompiler' ]
$P0.'language'('NQP') $P0.'language'('NQP')
$P0.'parsegrammar'('NQP::Grammar') $P0.'parsegrammar'('NQP::Grammar')
$P0.'parseactions'('NQP::Grammar::Actions') $P0.'parseactions'('NQP::Grammar::Actions')
$P0 = new 'Integer' $P0 = new 'Integer'
set_hll_global ['NQP::Grammar'], '$!endstmt', $P0 set_hll_global ['NQP';'Grammar'], '$!endstmt', $P0
.end .end
.sub 'main' :main .sub 'main' :main
Expand Down
12 changes: 6 additions & 6 deletions compilers/nqp/src/Grammar.pg
Expand Up @@ -31,13 +31,13 @@ token TOP {
## yet handle all valid forms of Perl 6 whitespace. ## yet handle all valid forms of Perl 6 whitespace.
token ws { token ws {
{{ $P0 = match.'to'() {{ $P0 = match.'to'()
$P1 = get_hll_global [ 'NQP::Grammar' ], '$!ws' $P1 = get_hll_global [ 'NQP';'Grammar' ], '$!ws'
if null $P1 goto set_new_ws if null $P1 goto set_new_ws
$P2 = $P1.'to'() $P2 = $P1.'to'()
if $P0 != $P2 goto set_new_ws if $P0 != $P2 goto set_new_ws
.return (1) .return (1)
set_new_ws: set_new_ws:
set_hll_global [ 'NQP::Grammar' ], '$!ws', match set_hll_global [ 'NQP';'Grammar' ], '$!ws', match
}} }}
[ \s+ [ \s+
| ^^ [ \# \N* | ^^ [ \# \N*
Expand All @@ -51,7 +51,7 @@ token ws {
token afterws { token afterws {
## <?{ $¢ == $!ws_to != $!ws_from }> ## <?{ $¢ == $!ws_to != $!ws_from }>
{{ $P0 = match.'to'() {{ $P0 = match.'to'()
$P1 = get_hll_global [ 'NQP::Grammar' ], '$!ws' $P1 = get_hll_global [ 'NQP';'Grammar' ], '$!ws'
$P2 = $P1.'to'() $P2 = $P1.'to'()
if $P0 != $P2 goto end if $P0 != $P2 goto end
$P2 = $P1.'from'() $P2 = $P1.'from'()
Expand Down Expand Up @@ -121,8 +121,8 @@ token terminator { <[ } \] ) ]> | $ }
token statement_end { token statement_end {
|| ';' || ';'
|| <?before <terminator>> || <?before <terminator>>
|| {{ $P0 = get_hll_global ['NQP::Grammar'], '$!endstmt' || {{ $P0 = get_hll_global ['NQP';'Grammar'], '$!endstmt'
$P1 = get_hll_global ['NQP::Grammar'], '$!ws' $P1 = get_hll_global ['NQP';'Grammar'], '$!ws'
$P2 = $P1.'from'() $P2 = $P1.'from'()
if $P0 != $P2 goto end if $P0 != $P2 goto end
.return (1) .return (1)
Expand All @@ -133,7 +133,7 @@ token statement_end {
token MARK_STATEMENT_END { token MARK_STATEMENT_END {
{{ $P0 = match.'to'() {{ $P0 = match.'to'()
$P0 = clone $P0 $P0 = clone $P0
set_hll_global ['NQP::Grammar'], '$!endstmt', $P0 set_hll_global ['NQP';'Grammar'], '$!endstmt', $P0
}} }}
<.ws> <.ws>
} }
Expand Down
9 changes: 5 additions & 4 deletions compilers/nqp/src/Grammar/Actions.pir
Expand Up @@ -2,15 +2,16 @@
# $Id$ # $Id$


.sub '__onload' :init :load .sub '__onload' :init :load
$P0 = newclass 'NQP::Grammar::Actions' $P0 = get_hll_global 'P6metaclass'
$P0 = $P0.'new_class'('NQP::Grammar::Actions')


## create the stack for nested lexical blocks ## create the stack for nested lexical blocks
$P0 = new 'ResizablePMCArray' $P0 = new 'ResizablePMCArray'
set_hll_global ['NQP::Grammar::Actions'], '@?BLOCK', $P0 set_hll_global ['NQP';'Grammar';'Actions'], '@?BLOCK', $P0


## initialize optable with inline PIR ## initialize optable with inline PIR
.local pmc optable .local pmc optable
optable = get_hll_global [ 'NQP::Grammar' ], '$optable' optable = get_hll_global [ 'NQP';'Grammar' ], '$optable'


optable['postfix:++'; 'inline'] = <<" END" optable['postfix:++'; 'inline'] = <<" END"
## inline postfix:++ ## inline postfix:++
Expand All @@ -27,7 +28,7 @@
.return () .return ()
.end .end
.namespace [ 'NQP::Grammar::Actions' ] .namespace [ 'NQP';'Grammar';'Actions' ]
## method TOP($/, $key) { ## method TOP($/, $key) {
Expand Down

0 comments on commit 1ebf2db

Please sign in to comment.