[TransWarp] fmtparse - recursive grammar

Oleg Broytmann phd at work.phd.pp.ru
Fri Jun 13 16:42:00 EDT 2003


On Fri, Jun 13, 2003 at 04:11:26PM -0400, Phillip J. Eby wrote:
> query = Sequence()
> query.initArgs = and_or, '(', query, ')'
> query.rules = query._computeRules()

   Yes, that is how I am trying to do this now; only I use Alternatives and
do

and_or = Alternatives("and", "or")
query = Alternatives()
and_or_func = Sequence(and_or, '(', Repeat(query, minCt=1), ')')
query.alternatives = [adapt(a, Rule) for a in Field("name"), cmp_expr, and_or_func]

> Perhaps you could contribute a patch to change fmtparse to use Once 
> bindings for all adapt() on input arguments?

   I'll try... but do not expect the patch too soon...

   Meanwhile, there is a bug in Repeat class: sepIsTerm was not defined,
but used; actually the variable mentioned only once in the file.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.



More information about the PEAK mailing list