[TransWarp] fmtparse - recursive grammar
Oleg Broytmann
phd at work.phd.pp.ru
Fri Jun 13 15:39:20 EDT 2003
Hello!
Can I parse a recursive grammar using fmtparse?
For example, I want to parse queries like this:
and(1, or(xxx, yyy))
or(month, and(ttt, uuu))
and so on. EBNF grammar is something like
query -> and_or(query, ...)
and_or -> and | or
(without all annoying details).
Now I am trying to write a parser:
from peak.util.fmtparse import *
and_or = Alternatives("and", "or")
query = Sequence(and_or, '(', query, ')')
Oops, query referenced before assignment...
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