On Thu, Jun 30, 2005 at 11:46:55PM -0400, Allison Randal wrote: > On Jun 25, 2005, at 20:38, Patrick R. Michaud wrote: > > >I've just checked in changes to PGE that enable it to support > >grammars, as well as some more built-in rules... > > These are totally awesome. On the plane today, I converted the Punie > parser over to use the shiny new grammars. My one frustration so far is > that subrule calls for a rule from a grammar always have to be fully > specified, even if the subrule is in the same grammar.
Well, it's not *supposed* to work that way -- it's supposed to work the way you expect it to -- i.e., "<expr>" in a rule calls the the "expr" rule in the current grammar. > p6rule("1", "PunieGrammar", "term") > p6rule("print \s* <expr>", "PunieGrammar", "gprint") > p6rule("<gprint> | <term>", "PunieGrammar", "expr") > p6rule("<expr>;", "PunieGrammar", "line") It seems to work for me (r8486)... [EMAIL PROTECTED] pge]$ cat punie.pir .sub main @MAIN .local pmc p6rule .local pmc myrule .local pmc match load_bytecode 'PGE.pir' p6rule = find_global "PGE", "p6rule" p6rule("1", "PunieGrammar", "term") p6rule("print \s* <expr>", "PunieGrammar", "gprint") p6rule("<gprint> | <term>", "PunieGrammar", "expr") p6rule("<expr>;", "PunieGrammar", "line") myrule = p6rule("<PunieGrammar::line>") match = myrule("print print 1;") match."dump"() .end $ parrot punie.pir : <print print 1; @ 0> 0 <PunieGrammar::line>: <print print 1; @ 0> 0 <PunieGrammar::line><expr>: <print print 1 @ 0> 0 <PunieGrammar::line><expr><gprint>: <print print 1 @ 0> 0 <PunieGrammar::line><expr><gprint><expr>: <print 1 @ 6> 0 <PunieGrammar::line><expr><gprint><expr><gprint>: <print 1 @ 6> 0 <PunieGrammar::line><expr><gprint><expr><gprint><expr>: <1 @ 12> 1 <PunieGrammar::line><expr><gprint><expr><gprint><expr><term>: <1 @ 12> 1 $ Perhaps you can send me a copy of your code so I can take a look...? Pm