Skip to content

Commit 2e788f6

Browse files
committed
Move NQP into a HLL of its own. This is a pre-req for being able to HLL-map things for NQP's use, but will also go a long way to resolving NQP/NQP-rx symbol conflicts.
1 parent 080d583 commit 2e788f6

File tree

7 files changed

+27
-2
lines changed

7 files changed

+27
-2
lines changed

src/HLL.pir

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and HLL::Grammar.
1313

1414
=cut
1515

16+
.HLL 'nqp'
17+
1618
.sub '' :anon :load :init
1719
load_bytecode 'Regex.pbc'
1820
.end

src/NQP/Actions.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ method comp_unit($/) {
7777
)
7878
);
7979
$unit.node($/);
80+
81+
# Set HLL.
82+
$unit.hll('nqp');
83+
8084
make $unit;
8185
}
8286

src/NQP/Compiler.pir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ NQP::Compiler - NQP compiler
88

99
=cut
1010

11+
.HLL 'nqp'
12+
1113
# Initialize meta-model.
1214
.loadlib "nqp_group"
1315
.loadlib "nqp_ops"
@@ -18,6 +20,13 @@ NQP::Compiler - NQP compiler
1820

1921
.sub '' :anon :load :init
2022
load_bytecode 'P6Regex.pbc'
23+
24+
## Bring in PAST and PCT
25+
.local pmc hllns, parrotns, imports
26+
hllns = get_hll_namespace
27+
parrotns = get_root_namespace ['parrot']
28+
imports = split ' ', 'PAST PCT'
29+
parrotns.'export_to'(hllns, imports)
2130
.end
2231

2332
.include 'gen/nqp-grammar.pir'

src/Regex.pir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ This file brings together the various Regex modules needed for Regex.pbc .
1010

1111
=cut
1212

13+
.HLL 'nqp'
14+
1315
.include 'src/Regex/Cursor.pir'
1416
.include 'src/Regex/Cursor-builtins.pir'
1517
.include 'src/Regex/Cursor-protoregex-peek.pir'
1618
.include 'src/Regex/Match.pir'
1719
.include 'src/Regex/Method.pir'
1820
.include 'src/Regex/Dumper.pir'
1921

22+
.HLL 'parrot'
23+
2024
.include 'src/PAST/Regex.pir'
2125
.include 'src/PAST/Compiler-Regex.pir'
2226

src/Regex/Match.pir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ This file implements Match objects for the regex engine.
1717
load_bytecode 'P6object.pbc'
1818
.local pmc p6meta
1919
p6meta = new 'P6metaclass'
20-
$P0 = p6meta.'new_class'('Regex::Match', 'parent'=>'Capture', 'attr'=>'$!cursor $!target $!from $!to $!ast')
20+
$P1 = get_root_global ['parrot'], 'Capture'
21+
$P0 = p6meta.'new_class'('Regex::Match', 'parent'=>$P1, 'attr'=>'$!cursor $!target $!from $!to $!ast')
2122
.return ()
2223
.end
2324

src/Regex/P6Regex.pir

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Regex::P6Regex - Parser/compiler for Perl 6 regexes
99

1010
=cut
1111

12+
.HLL 'nqp'
13+
1214
.sub '' :anon :load :init
1315
load_bytecode 'HLL.pbc'
1416
.end

src/cheats/parrot-callcontext.pir

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This adds to a Parrot PMC, so need to switch to that HLL for this
2+
# file.
3+
.HLL 'parrot'
14
.namespace ['CallContext']
25
.sub 'lexpad_full' :method
36
.local pmc ctx, lexall, lexpad, lexpad_it
@@ -23,4 +26,4 @@
2326
context_done:
2427
.return (lexall)
2528
.end
26-
29+
.HLL 'nqp'

0 commit comments

Comments
 (0)