On Sun, Jun 12, 2005 at 12:57:56PM +0200, Chip Salzenberg wrote:
> On Fri, Jun 10, 2005 at 05:18:19PM -0400, William Coleda wrote:
> > Looking through the PGE test examples, it *looks* like subrules are just 
> > globals.
> 
> I'm sure that's not how it'll behave when it's done, though I don't
> know PGE well enough yet to suggest how it will work exactly.  In the
> meantime, I guess you'll need to use the standard mangling tricks
> (e.g. prepending "__pge_" to rule names).

At the present, PGE rules are just globals because I've still been
working out the details about where rules belong in a namespace.
See the thread on perl6-language starting at 
http://www.nntp.perl.org/group/perl.perl6.language/21692 .

It's looking more and more as though named rules (subrules) are 
actually methods of class "Rule" or one of its grammar subclasses, 
and that "PGE::Match" objects (the things being returned from a match) 
are actually Rule objects.

At the moment the only way I know to create a method in a PIR class 
is to use the .namespace directive and a "method" subpragma at the
time the PIR code is compiled -- i.e., I haven't seen a way to take
an existing subroutine PMC and install it as a method in an existing
class.  This isn't a big issue in itself, it just means that one
has to supply the name and grammar of the rule at the time the rule is 
being compiled (rather than compiling a rule and storing the resulting
subroutine/method in a symbol table afterwards).

Of course, I may be overlooking the right way to do this, but that's
where things stand at the moment.

Pm

Reply via email to