One of the comments on reddit when I announced codetalker was "what's wrong with pyparsing?"
So I thought I'd run some comparisons, detailing why I felt the need to reinvent this particular wheel.
My favorite entry-level parsing project is JSON; it's about as simple as a grammar gets while still having a great deal of real world value. So I looked around for some examples of parsing JSON with pyparsing, and thought I'd throw in PLY for good measure.
Implementations
- PyParsing: source (I had to modify the code from these slides slightly to output the correct results)
- CodeTalker: codetalker.contrib.json taken from the contrib section of my codetalker library
- PLY: json-ply available on google code
[of course, these represent one person's usage and are not the only possible implementations, but I think they are a good example of each library]
Anyway, here are the stats: [live online graph]
If it's not clear, lower is better.
And in addition to the raw stats, I think codetalker's way of defining grammars if more intuitive & has a better correlation to the traditional BNF style.
Of course, to each their own -- just because codetalker is more intuitive to me doesn't mean it will be for you -- take a look at the code, and take your pick.
What experience do you have with parser generators? Is there some killer library I left out? Feel free to tell me in the comments.