Re: PGE and TGE vs. .namespace

2006-07-09 Thread Dr.Ruud
Allison Randal schreef:
 Chip Salzenberg:

 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'.

Maybe an automagical namespace alias 'root' is feasible?

-- 
Affijn, Ruud

Gewoon is een tijger.




PGE and TGE vs. .namespace

2006-07-06 Thread Chip Salzenberg
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 [EMAIL PROTECTED]


Re: PGE and TGE vs. .namespace

2006-07-06 Thread Allison Randal

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


Re: PGE and TGE vs. .namespace

2006-07-06 Thread Chip Salzenberg
On Thu, Jul 06, 2006 at 04:44:35PM -0700, jerry gay wrote:
 On 7/6/06, Allison Randal [EMAIL PROTECTED] 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 [EMAIL PROTECTED]


Re: PGE and TGE vs. .namespace

2006-07-06 Thread Allison Randal

jerry gay wrote:

On 7/6/06, Allison Randal [EMAIL PROTECTED] 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


Re: PGE and TGE vs. .namespace

2006-07-06 Thread Chip Salzenberg
On Thu, Jul 06, 2006 at 05:22:47PM -0700, Allison Randal wrote:
 jerry gay wrote:
 On 7/6/06, Allison Randal [EMAIL PROTECTED] 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.  I actually made it worse, to my great surprise.  Still
hacking tho...
-- 
Chip Salzenberg [EMAIL PROTECTED]


Re: PGE and TGE vs. .namespace

2006-07-06 Thread Chip Salzenberg
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]