Language-python: A Python Parser Written in Haskell
haskell.org
haskell.org
I wonder why they choose Alex/Happy instead of Parsec though. From my, admittedly limited, viewpoint Parsec looks brilliant for parsers that can be reused and combined in interesting ways. My experience with it is limited to having done a piece of coursework in it for a compilers course (took me a few hours to do the coursework for the entire course vs. a lot longer for people using other tools).
Anyone who knows a little more about these things who can comment on the pros and cons of Parsec that I may have missed? Is it just that performance isn't as good or is there more to it?
Parsec is indeed very nice, and I highly recommend it for pretty much any kind of parsing task. It certainly beats the pants off flex & bison. The biggest drawback I've found is that it has no support for error recovery. Once an error has been detected, Parsec prints it and aborts. It would be nice if you could make it recover by skipping to the next language element and accumulate the errors.
You can't really divide the stream without parsing it, due to things that change the meaning of "{" and "}", like /* and ".
Parsing is hard.
I really should try to get those working, because I think they would be useful additions to Parsec.