Learning Parser Combinators with Rust
&gt;&gt; The novice programmer will ask, &quot;what is a parser?&quot;<p>&gt;&gt; The intermediate programmer will say, &quot;that&#x27;s easy, I&#x27;ll write a regular expression.&quot;<p>&gt;&gt; The master programmer will say, &quot;stand back, I know lex and yacc.&quot;<p>The Prolog programmer will write a Definite Clause Grammar [1], which is both a grammar and a parser, two-in-one. So you only have to do the easy and fun bit of writing a parser, which is defining the grammar.<p>Leaves plenty of time to get online and brag about the awesome power of Prolog or get embroiled in flamewars with functional programming folks [2].<p>______________<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Definite_clause_grammar" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Definite_clause_grammar</a><p>[2] Actually, DCGs are kiiind of like parser combinators. Ish. In the sense that they&#x27;re executable grammars. But in Prolog you can run your programs backwards so your DCG is both a recogniser <i>and</i> a generator.