Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PGE and TGE vs. .namespace

0 views
Skip to first unread message

Chip Salzenberg

unread,
Jul 6, 2006, 2:13:31 PM7/6/06
to Patrick R. Michaud, Allison Randal, parrot-...@perl.org
The below patches are my guess as to how to fix PGE and TGE for the recent
change in .namespace. (That is, C<.namespace ['']> now means what it says,
and the HLL root is reachable by C<.namespace> w/o parameters.)

The TGE patch seems to work, but I got test failure from my PGE patch.
Patrick? Allison?

=== compilers/tge/TGE/Compiler.pir
==================================================================
--- compilers/tge/TGE/Compiler.pir (revision 13181)
+++ compilers/tge/TGE/Compiler.pir (local)
@@ -380,6 +380,9 @@
.return (code)
.end

+# NOTE - this code assumes that a type of '' is impossible
+# (in older versions of Parrot, it was)
+
.sub 'grammar_string' :method
.param pmc grammar
.local string code
@@ -387,9 +390,13 @@
.local string inherit
type = grammar["type"]
inherit = grammar["inherit"]
- code = "\n.namespace [ '"
+ code = "\n.namespace"
+ if type == '' goto no_type
+ code .= " [ '"
code .= type
- code .= "' ]\n\n"
+ code .= "' ]"
+ no_type:
+ code .= "\n\n"
code .= ".sub '__onload' :load\n"
code .= " load_bytecode 'TGE.pbc'\n"
code .= " $I0 = find_type '"

=== compilers/pge/PGE/P6Regex.pir
==================================================================
--- compilers/pge/PGE/P6Regex.pir (revision 13181)
+++ compilers/pge/PGE/P6Regex.pir (local)
@@ -117,9 +117,14 @@
pir:
.local pmc code
.local string grammar
+ .local string nsformat
grammar = adverbs['grammar']
+ nsformat = ".namespace"
+ if grammar == '' goto pir_emit
+ nsformat = ".namespace [ '%0' ]"
+ pir_emit:
code = new 'PGE::CodeString'
- code.emit(".namespace [ '%0' ]", grammar)
+ code.emit(nsformat, grammar)
$P0 = exp.root_pir(adverbs :flat :named)
code .= $P0
if target != 'PIR' goto bytecode


--
Chip Salzenberg <ch...@pobox.com>

Allison Randal

unread,
Jul 6, 2006, 6:29:59 PM7/6/06
to Chip Salzenberg, Patrick R. Michaud, parrot-...@perl.org
Chip Salzenberg wrote:
> The below patches are my guess as to how to fix PGE and TGE for the recent
> change in .namespace. (That is, C<.namespace ['']> now means what it says,
> and the HLL root is reachable by C<.namespace> w/o parameters.)

TGE and PGE both need a thorough going-over for the new namespaces
implementation.

I'm thinking they should act in an HLL-agnostic fashion, so it's
possible to compile one grammar in, say, the Perl 6 HLL namespace,
another in Ruby, another in Python, and another system-internal grammar
into 'parrot'.

Allison

Chip Salzenberg

unread,
Jul 6, 2006, 7:57:50 PM7/6/06
to jerry gay, Allison Randal, Patrick R. Michaud, parrot-...@perl.org
On Thu, Jul 06, 2006 at 04:44:35PM -0700, jerry gay wrote:
> On 7/6/06, Allison Randal <all...@perl.org> wrote:
> >Chip Salzenberg wrote:
> >> The below patches are my guess as to how to fix PGE and TGE for the
> >recent
> >> change in .namespace. (That is, C<.namespace ['']> now means what it
> >says,
> >> and the HLL root is reachable by C<.namespace> w/o parameters.)
> >
> >TGE and PGE both need a thorough going-over for the new namespaces
> >implementation.
> >
> meanwhile, back at the ranch, perl6 is failing all
> t/00-parrot/08-regex.t tests due to the .namespace changes. chip's
> proposed PGE patch fixes those failures.

Indeed, the patch has nothing to do with extending full nested namespace
support to TGE and PGE. It's just a regression fix now that .namespace ['']
doesn't do what it used to.

Unless you're planning to do that overhaul before 0.4.6, I'd like to at
least avoid those regressions.
--
Chip Salzenberg <ch...@pobox.com>

Jerry Gay

unread,
Jul 6, 2006, 7:44:35 PM7/6/06
to Allison Randal, Chip Salzenberg, Patrick R. Michaud, parrot-...@perl.org
On 7/6/06, Allison Randal <all...@perl.org> wrote:
> Chip Salzenberg wrote:
> > The below patches are my guess as to how to fix PGE and TGE for the recent
> > change in .namespace. (That is, C<.namespace ['']> now means what it says,
> > and the HLL root is reachable by C<.namespace> w/o parameters.)
>
> TGE and PGE both need a thorough going-over for the new namespaces
> implementation.
>
meanwhile, back at the ranch, perl6 is failing all
t/00-parrot/08-regex.t tests due to the .namespace changes. chip's
proposed PGE patch fixes those failures.

i don't mind broken tests between releases, but if this patch won't be
applied in the next day or three, let me know. the tests can be marked
as TODO, and we can eagerly wait for the day of unexpected success
that will surely follow.
~jerry

Allison Randal

unread,
Jul 6, 2006, 8:22:47 PM7/6/06
to jerry gay, Chip Salzenberg, Patrick R. Michaud, parrot-...@perl.org
jerry gay wrote:
> On 7/6/06, Allison Randal <all...@perl.org> wrote:
>
> meanwhile, back at the ranch, perl6 is failing all
> t/00-parrot/08-regex.t tests due to the .namespace changes. chip's
> proposed PGE patch fixes those failures.

Oh, I didn't mean "don't apply it", just "there's more work ahead". I
can't speak for Patrick, but go ahead and apply the TGE patch.

Chip, did you resolve the failing PGE test(s)?

Allison

Chip Salzenberg

unread,
Jul 7, 2006, 1:01:39 AM7/7/06
to Allison Randal, jerry gay, Patrick R. Michaud, parrot-...@perl.org

Oddly enough, no. I actually made it worse, to my great surprise. Still
hacking tho...
--
Chip Salzenberg <ch...@pobox.com>

Chip Salzenberg

unread,
Jul 7, 2006, 1:18:30 AM7/7/06
to Allison Randal, jerry gay, Patrick R. Michaud, parrot-...@perl.org
On Thu, Jul 06, 2006 at 10:01:39PM -0700, Chip Salzenberg wrote:
> On Thu, Jul 06, 2006 at 05:22:47PM -0700, Allison Randal wrote:
> > jerry gay wrote:
> > >On 7/6/06, Allison Randal <all...@perl.org> wrote:
> > >
> > >meanwhile, back at the ranch, perl6 is failing all
> > >t/00-parrot/08-regex.t tests due to the .namespace changes. chip's
> > >proposed PGE patch fixes those failures.
> >
> > Oh, I didn't mean "don't apply it", just "there's more work ahead". I
> > can't speak for Patrick, but go ahead and apply the TGE patch.
> >
> > Chip, did you resolve the failing PGE test(s)?
>
> Oddly enough, no.

Strangely enough, yes. Apparently I hadn't waved enough 'make clean'
chickens over the computer. All better now.
--
Chip Salzenberg <ch...@pobox.com>

Dr.Ruud

unread,
Jul 9, 2006, 10:25:00 AM7/9/06
to perl6-i...@perl.org
Allison Randal schreef:
> Chip Salzenberg:

Maybe an automagical namespace alias 'root' is feasible?

--
Affijn, Ruud

"Gewoon is een tijger."


0 new messages