Show HN: How to write a recursive descent parser
I don&#x27;t understand why so many people glorify hand-written parsers. Maybe because they never used good parser generators (not unlike type systems and Java) ?<p>Personal opinion: writing parsers is the least interesting part of an interpreter&#x2F;compiler, and your grammar <i>should</i> be boring if you want your syntax to be easy to understand by humans.<p>Boring, in this case, mean LL(*), LR(1), or another well known class. Just pick a damn parser generator and get the job done quickly, so you can spend time on the really difficult tasks. The grammar in this article is LR(1) and is trivial to implement in yacc-like generators, locations tracking and error messages included.<p>Bonus point: since your grammar stays in a well known class, it&#x27;s much easier for other people to re-implement it. You can&#x27;t introduce bullshit ambiguous extensions to your grammar (C typedefs, anyone ?). This article gives a good explanation of this: <a href="http:&#x2F;&#x2F;blog.reverberate.org&#x2F;2013&#x2F;09&#x2F;ll-and-lr-in-context-why-parsing-tools.html" rel="nofollow">http:&#x2F;&#x2F;blog.reverberate.org&#x2F;2013&#x2F;09&#x2F;ll-and-lr-in-context-why...</a>