Patrick R. Michaud wrote:
On Sat, Dec 15, 2007 at 05:45:56PM +0200, Allison Randal wrote:
Patrick R. Michaud via RT wrote:
Yes, I didn't quite expect anyone to be using PCT::HLLCompiler with
PAST-pm, or supplying their own PAST->POST transformation.

If we need to put the ostgrammar back into the HLLCompiler, we can do
that.
Supplying your own PAST->POST transformation should at least be an option. HLLCompiler is useful for all HLLs, even ones that don't use PGE, NQP, PAST, or POST at all in their implementation.

It is possible now. I've been thinking that the way for someone to supply a custom PAST->POST transformation would be any or all of:

1.  Use the addstage(), removestage(), or stages() methods to
    change the compiler stage sequence and/or introduce new
    or replacement stages for the PAST->POST step.

2. Subclass the PCT::HLLCompiler class to provide a custom 'post' method that calls whatever is desired.

3.  Subclass the PAST::Compiler class to provide custom PAST->POST
    transformations that might not exist in standard PCT.

Given that this gives us at least three "good" ways to supply
a custom PAST->POST transformation into PCT::HLLCompiler, I didn't
think we really needed a fourth one that is specific to ostgrammars
and TGE.

I'm also thinking that HLLGrammar may evolve slightly so that
each translator can globally register itself with HLLCompilers as
"I know how to transform something of type Foo into another thing
of type Bar".  Then an ostgrammar would simply register itself
as another PAST->POST converter, and a HLLCompiler would have some way of
saying "use the ostgrammar instead of POST::Compiler".


The monthly release is today.
So in Lua, I reverted the revision 23368 (HLLCompiler -> PCT::HLLCompiler). And Lua works with the old HLLCompiler library.
And I'll try to overload PCT::HLLCompiler for the next release 0.5.2.

But, I've another problem : some failure with languages/lua/t/test_lex.t
The following patch fixes it.
But I don't understand why now I must duplicate the declaration of the token 'ws' in lua51_testlex.pg grammar ; previously this token was imported for lua51.pg (the full Lua Grammar).

François.

Pm





Index: languages/lua/src/lua51_testlex.pg
===================================================================
--- languages/lua/src/lua51_testlex.pg	(revision 24033)
+++ languages/lua/src/lua51_testlex.pg	(working copy)
@@ -92,6 +92,13 @@
     | \]
 }
 
+token ws {
+    [ \s+
+    | '--' <long_comment>
+    | '--' \N*
+    ]*
+}
+
 =head1 AUTHOR
 
 Francois Perrad
Index: languages/lua/test_lex.pir
===================================================================
--- languages/lua/test_lex.pir	(revision 24033)
+++ languages/lua/test_lex.pir	(working copy)
@@ -48,8 +48,6 @@
     # import Lua::Grammar::* into Lua::TestLex
     $P0 = get_hll_global ['Lua::Grammar'], 'string'
     set_hll_global ['Lua::TestLex'], 'String', $P0
-    $P0 = get_hll_global ['Lua::Grammar'], 'ws'
-    set_hll_global ['Lua::TestLex'], 'ws', $P0
 
     $P0 = get_hll_global ['Lua::Grammar'], 'syntaxerror'
     set_hll_global ['Lua::TestLex'], 'die', $P0

Reply via email to