Recommendation of a parser generator

Bengt Richter bokr at oz.net
Fri Aug 8 23:57:38 EDT 2003


On 8 Aug 2003 15:06:33 -0700, fortepianissimo at yahoo.com.tw (Fortepianissimo) wrote:

>I'm about to start a new project which will be mostly written in
>Python. The first task is to parse some formula-like expressions into
>an internal data structure so they can be evaluated.
>
>This parser would be run extensively in the future, so speed is a
>consideration, although at this point to get something up and running
>is more important. Also there's a strong possibility of changing the
>formula grammar in the future (although the change probably would be
>some minor addition/changes).
>
>I took a look at http://www.python.org/sigs/parser-sig/towards-standard.html,
>and went to check BisonGen and found out it's 2-year old now (this is
>the fastest one reported in the survey). I checked YAPPS but accordint
>to the author it's not designed for efficiency and the parsing
>technique has limitations compared to others. Also checked Simpleparse
>and found it has to be installed with another toolkit, etc.
>
>I'd appreciate very much some expert suggestions from the group, like
>on the speed, flexibility, portability, and the future prospect (like
>to be adopted as the standard etc.).
>
A while ago now I wrote a specialized parser for HTML using GNU flex and C++
with some minimal STL, and it turned out fast, I thought. Flex is 'way more flexible
than a simple tokenizer. There may be something better now, but that's where
I'd go (obviously familiarity biases ;-) if I was worried about speed faster
than Python.

BTW, I wonder if there is a Python parser generator that will take
a flex-format grammar as input. Then a transition would be easier.

Regards,
Bengt Richter




More information about the Python-list mailing list