News for hackers. Stuff that matters.
Re:Show HN: How to write a recursive descent parser by UK-AL on Monday March 20, 2017 @11:16AM (#13914872)
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.

Re:Show HN: How to write a recursive descent parser by wruza on Monday March 20, 2017 @11:31AM (#13914989)
>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.

Re:Show HN: How to write a recursive descent parser by paulddraper on Monday March 20, 2017 @02:28PM (#13916467)
ANTLR has hooks you can use to help the error message.

Though it uses Java. What is a "default platform"?

Re:Show HN: How to write a recursive descent parser by userbinator on Monday March 20, 2017 @09:53PM (#13919193)
Yet 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.