| Every few years I look at the latest parser combinators, parser generators, compiler compilers. And every time they seem to lack in some huge vital way (not always all of them, but always at least 1): * Error handling always ends up being non-existent or of the quality of "begin, for, if, while, repeat, identifier, number, float expected" with no good way to override what happens * Recovery is usually impossible * Parser generator generates a full model that doesn't match what we need * Working around the quirks of the input language ends up being more tricky than hand writing (almost every language has some ambigiuty) * Slow: With ANTLR it's really easy to make it do gigantic amount of look aheads in complex languages, which isn't even really needed I always end up going back to a simple hand crafted parser which is easier to read and write. |
Probably true in many toy-versions.
However parser combinators are very well suited for overriding the default expectation error messages with something custom. For example using a custom combinator `<?>` with low precedence.
No the parser won't enumerate all the options, but now can give you a high level expectation.> * Recovery is usually impossible
There are a bunch of error correcting combinator libraries out there.
Also, when using monadic combinators you can do all kinds of retrospective work while parsing. Probably more expensive, but entirely possible. Some pseudo Haskell example: