By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,773 Members | 1,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,773 IT Pros & Developers. It's quick & easy.

best option for python lex/yacc?

P: n/a
mh
I'm porting a C lex/yacc based project, and would like to redo
it in python.

What's the best option for a python lex/yacc-like? I've
googled a few things, but wanted to see the current concensus.

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Jun 30 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On Jun 30, 1:47*am, m...@pixar.com wrote:
I'm porting a C lex/yacc based project, and would like to redo
it in python.

What's the best option for a python lex/yacc-like? *I've
googled a few things, but wanted to see the current concensus.

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
For a full list, see http://nedbatchelder.com/text/python-parsers.html

For lex/yacc-like's, PLY, Spark, simpleparse, or ANTLR are probably
the leaders.

If you consider using pyparsing, then *don't* just try to do a
straight transliteration from your existing lex/yacc implementation -
you will end up fighting some of pyparsing's basic concepts.

But if you already have this implemented and working in C, and given
that parsing usually is such a performance-sucking operation, why not
package the existing parser into a lib, and call it from python using
ctypes, or some similar technology for embedding C code in Python?

-- Paul
Jun 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.