Home > Archive > Compilers > May 2007 > any experience with PLY?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
any experience with PLY?
|
|
| Mark T 2007-05-13, 7:18 pm |
| I'm contemplating using PLY to create a source to source translator -
one assembler language (custom CPU) to another assembler language
(standard CPU). I have some limited lex/yacc experience.
Are there any other parser-generator tools I should consider? or
should I just hand code everything?
thanks
Mark
| |
| Nicola Musatti 2007-05-16, 4:20 am |
| On May 13, 9:08 pm, Mark T <mark...@yahoo.com> wrote:
> I'm contemplating using PLY to create a source to source translator -
> one assembler language (custom CPU) to another assembler language
> (standard CPU). I have some limited lex/yacc experience.
PLY was actually my first experience with a lex/yacc style generator
and I found it extremely convenient. Some theoretical background helps
in avoiding mistakes and diagnosing bugs, but one can always resort to
good ol' trial & error ;-)
I used PLY to parse a subset of SQL DDL. I already had a hand coded C+
+ parser for an even smaller subset, but I'm convinced that it took me
less to rewrite it in Python with PLY than it would have taken to
modify my C++ one.
Another advantage that should not be overlooked is the number of
libraries that are available to Python programmers, which may come
handy for other parts of one's application.
> Are there any other parser-generator tools I should consider? or
> should I just hand code everything?
Just about everybody around here is in a better position to answer
this question than I am.
Cheers,
Nicola Musatti
| |
|
| On May 13, 12:08 pm, Mark T <mark...@yahoo.com> wrote:
> I'm contemplating using PLY to create a source to source translator -
> one assembler language (custom CPU) to another assembler language
> (standard CPU). I have some limited lex/yacc experience.
>
> Are there any other parser-generator tools I should consider? or
> should I just hand code everything?
I am certainly biased, but I think that Parsing is the greatest thing
since sliced bread, at least as far as Python-based parser generators
go. Parsing is an LR(1) parser generator, and it includes both CFSM
("LR") and GLR parser drivers.
Parsing: http://www.canonware.com/download/Parsing/Parsing.py
Example: http://www.canonware.com/download/P...les/example1.py
Don't let the simplicity of the example fool you into thinking that
Parsing is a toy -- I have used it for some very large grammars, with
great success.
Jason
|
|
|
|
|