3 ms·
There's a reason nearly every actually used programming language parser is hand rolled. It's easier for adding errors messages, debugging and diagnostics tools
by UK-AL 10y ago
There's a reason nearly every actually used programming language parser is hand rolled.
It's easier for adding errors messages, debugging and diagnostics tools. I know modern parser generators can do this as well. It's just easier in a recursive descent parser.
Learning to use parser generator is a learning experience in itself. Most can be pretty complicated to use, once you get past the basics. Yet nearly every programmer can understand a recursive descent parser. You can debug them using standard breakpoints for example. Yet parser generators can output quite difficult error messages, unless you have had a parser education.
In practical implementations, recursive descent can be optimised to be really fast, and to use a low amount of memory.
- wruza 10y ago>I know modern parser generators can do this as well Can you please list them here? These without build/runtime dependencies on java and other non-default platforms. That alone would make the whole thread.
- paulddraper 10y agoANTLR has hooks you can use to help the error message. Though it uses Java. What is a "default platform"?
- userbinator 10y agoYet nearly every programmer can understand a recursive descent parser. ...and I also hypothesise that nearly every programmer will come up with some form of recursive descent parser if asked to parse a recursive language --- without ever having heard of the term "recursive descent" nor parser generators. It's the intuitive, "natural" solution to the problem.