Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move NQP into a HLL of its own. This is a pre-req for being able to H…
…LL-map things for NQP's use, but will also go a long way to resolving NQP/NQP-rx symbol conflicts.
  • Loading branch information
jnthn committed Mar 6, 2011
1 parent 080d583 commit 2e788f6
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/HLL.pir
Expand Up @@ -13,6 +13,8 @@ and HLL::Grammar.

=cut

.HLL 'nqp'

.sub '' :anon :load :init
load_bytecode 'Regex.pbc'
.end
Expand Down
4 changes: 4 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -77,6 +77,10 @@ method comp_unit($/) {
)
);
$unit.node($/);

# Set HLL.
$unit.hll('nqp');

make $unit;
}

Expand Down
9 changes: 9 additions & 0 deletions src/NQP/Compiler.pir
Expand Up @@ -8,6 +8,8 @@ NQP::Compiler - NQP compiler

=cut

.HLL 'nqp'

# Initialize meta-model.
.loadlib "nqp_group"
.loadlib "nqp_ops"
Expand All @@ -18,6 +20,13 @@ NQP::Compiler - NQP compiler

.sub '' :anon :load :init
load_bytecode 'P6Regex.pbc'

## Bring in PAST and PCT
.local pmc hllns, parrotns, imports
hllns = get_hll_namespace
parrotns = get_root_namespace ['parrot']
imports = split ' ', 'PAST PCT'
parrotns.'export_to'(hllns, imports)
.end

.include 'gen/nqp-grammar.pir'
Expand Down
4 changes: 4 additions & 0 deletions src/Regex.pir
Expand Up @@ -10,13 +10,17 @@ This file brings together the various Regex modules needed for Regex.pbc .

=cut

.HLL 'nqp'

.include 'src/Regex/Cursor.pir'
.include 'src/Regex/Cursor-builtins.pir'
.include 'src/Regex/Cursor-protoregex-peek.pir'
.include 'src/Regex/Match.pir'
.include 'src/Regex/Method.pir'
.include 'src/Regex/Dumper.pir'

.HLL 'parrot'

.include 'src/PAST/Regex.pir'
.include 'src/PAST/Compiler-Regex.pir'

Expand Down
3 changes: 2 additions & 1 deletion src/Regex/Match.pir
Expand Up @@ -17,7 +17,8 @@ This file implements Match objects for the regex engine.
load_bytecode 'P6object.pbc'
.local pmc p6meta
p6meta = new 'P6metaclass'
$P0 = p6meta.'new_class'('Regex::Match', 'parent'=>'Capture', 'attr'=>'$!cursor $!target $!from $!to $!ast')
$P1 = get_root_global ['parrot'], 'Capture'
$P0 = p6meta.'new_class'('Regex::Match', 'parent'=>$P1, 'attr'=>'$!cursor $!target $!from $!to $!ast')
.return ()
.end

Expand Down
2 changes: 2 additions & 0 deletions src/Regex/P6Regex.pir
Expand Up @@ -9,6 +9,8 @@ Regex::P6Regex - Parser/compiler for Perl 6 regexes

=cut

.HLL 'nqp'

.sub '' :anon :load :init
load_bytecode 'HLL.pbc'
.end
Expand Down
5 changes: 4 additions & 1 deletion src/cheats/parrot-callcontext.pir
@@ -1,3 +1,6 @@
# This adds to a Parrot PMC, so need to switch to that HLL for this
# file.
.HLL 'parrot'
.namespace ['CallContext']
.sub 'lexpad_full' :method
.local pmc ctx, lexall, lexpad, lexpad_it
Expand All @@ -23,4 +26,4 @@
context_done:
.return (lexall)
.end

.HLL 'nqp'

0 comments on commit 2e788f6

Please sign in to comment.