<story><title>Parser generators vs. handwritten parsers: surveying major languages in 2021</title><url>https://notes.eatonphil.com/parser-generators-vs-handwritten-parsers-survey-2021.html</url></story><parent_chain><item><author>recursivedoubts</author><text>I took the compilers class at Stanford and never really understood the algorithms of bottom up parsing, or even really how grammars worked.  I just made the tool work.&lt;p&gt;I then went to work at a private company, and an older guy who had gone to a state school that taught recursive descent (his was the last class to teach it) taught me how to do it.  In a month or so I had learned more about how grammars actually work, what ambiguity is, and so forth, than in my whole class at Stanford.&lt;p&gt;I now teach compilers at a university, and I teach recursive descent.</text></item></parent_chain><comment><author>userbinator</author><text>I recommend you also teach &amp;quot;precedence climbing&amp;quot;, which is basically a slight refactoring of RD to parameterise the recursive functions by level so that grammars with many levels don&amp;#x27;t require proportionally deep call stacks and it also massively reduces the duplication of code at each level:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.engr.mun.ca&amp;#x2F;~theo&amp;#x2F;Misc&amp;#x2F;exp_parsing.htm#climbing&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.engr.mun.ca&amp;#x2F;~theo&amp;#x2F;Misc&amp;#x2F;exp_parsing.htm#climbing&lt;/a&gt;</text></comment>
<story><title>Parser generators vs. handwritten parsers: surveying major languages in 2021</title><url>https://notes.eatonphil.com/parser-generators-vs-handwritten-parsers-survey-2021.html</url></story><parent_chain><item><author>recursivedoubts</author><text>I took the compilers class at Stanford and never really understood the algorithms of bottom up parsing, or even really how grammars worked.  I just made the tool work.&lt;p&gt;I then went to work at a private company, and an older guy who had gone to a state school that taught recursive descent (his was the last class to teach it) taught me how to do it.  In a month or so I had learned more about how grammars actually work, what ambiguity is, and so forth, than in my whole class at Stanford.&lt;p&gt;I now teach compilers at a university, and I teach recursive descent.</text></item></parent_chain><comment><author>recursivedoubts</author><text>as an aside, the parser for &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;hyperscript.org&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;hyperscript.org&lt;/a&gt; is recursive descent, and our motto is: &amp;quot;remember what our parser professors taught us, then do the opposite of that.&amp;quot;&lt;p&gt;There&amp;#x27;s some ugly stuff in there, but it&amp;#x27;s fun, all because we wrote it in recursive descent and can do whatever we darn well please.</text></comment>