Reommended compiler toolkit

M

Miki Tebeka

Hello All,

I'm looking for a pure python compiler toolkit (lexer + parser, like
flex + bison).

I've seen many:
ply (which I like most)
SPARK
Yapps
PyLR
kwParsing
Plex
FlexModule

Which one do you recommend?
Thanks.
Miki
 
D

Diez B. Roggisch

Miki said:
ply (which I like most)
SPARK
Yapps
PyLR
kwParsing
Plex
FlexModule

Which one do you recommend?

If you like ply - use it. I personally use spark, because its declarative
nature and the early parsing method - but thats just a matter of taste.
 
D

David M. Cooke

At some point said:
Hello All,

I'm looking for a pure python compiler toolkit (lexer + parser, like
flex + bison).
ply (which I like most)
SPARK
Yapps
kwParsing

[don't know about these]

This is just a lexer. You'll have to write your own parser. Pyrex uses
it, along with a hand-written recursive-descent parser. Although it
shouldn't be too hard to plug the lexer from this into one of the
other packages to do parsing.
PyLR
FlexModule

These two aren't pure python. PyLR has a C extension, and looks like
it hasn't been updated since 1997. FlexModule uses flex to make a
lexer, and also works with BisonModule (which uses bison) to make the parser.

I'm guessing for speed FlexModule is probably the fastest, but does
anybody have any experience with benchmarking different Python lexer/parsers?
 
D

Dang Griffith

Hello All,

I'm looking for a pure python compiler toolkit (lexer + parser, like
flex + bison).

I've seen many:
ply (which I like most)
SPARK
Yapps
PyLR
kwParsing
Plex
FlexModule

Which one do you recommend?
Thanks.
Miki
I use Paul McGuire's pyparsing, http://pyparsing.sourceforge.net.
It's pretty powerful, but uses Python to build the grammar,
instead of a BNF (or BNF-like) lexer.
--dang
 
H

huy

Miki said:
Hello All,

I'm looking for a pure python compiler toolkit (lexer + parser, like
flex + bison).

I've seen many:
ply (which I like most)
SPARK
Yapps
PyLR
kwParsing
Plex
FlexModule

Which one do you recommend?
Thanks.
Miki

Have a look at http://dparser.sourceforge.net/

It supports BNF (EBNF?) notation which IMO is nicer then the PLY grammar
specs. I haven't tried dparser yet, so let us know how it is (compared
to PLY) if you decide to use it.

Cheers,

Huy
 
D

Dang Griffith

Miki said:
Hello All,

I'm looking for a pure python compiler toolkit (lexer + parser, like
flex + bison).
[snip]

Have a look at http://dparser.sourceforge.net/

It supports BNF (EBNF?) notation which IMO is nicer then the PLY grammar
specs. I haven't tried dparser yet, so let us know how it is (compared
to PLY) if you decide to use it.
But it's not pure python. It includes a Python interface to the
C-based parser (via SWIG). OTOH, it does seem pretty powerful.
--dang
 

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
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top