3 ms·
>I personally prefer hand-written recursive descent parsers >using a parser combinator framework (like https://github.com https://github.com >/Geal/nom) over
by unboxed_type 9y ago
>I personally prefer hand-written recursive descent parsers
>using a parser combinator framework (like https://github.com https://github.com
>/Geal/nom) over parser generators.
Why?
- vidarh 9y agoWhy handwritten, or why using a parser combinator framework? Handwritten parsers are most commonly used because most tools have problems making things like proper error reporting good enough to be worthwhile. Parser combinators is really just a fancy way of composing a parser from higher order functions instead of writing out a function body. If well done it basically provides a DSL to build the parsers, and the way this works by composing small fragments is pretty much what we do with recursive descent anyway, so it's a good fit.