best option for python lex/yacc?

M

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
 
P

Paul McGuire

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top