2 ms·
It's harder to express complex grammars in combinator form. Combinators excel best for relatively simply regular languages (eg., json, html, etc.). Languages
by mjburgess 6y ago
It's harder to express complex grammars in combinator form.
Combinators excel best for relatively simply regular languages (eg., json, html, etc.).
Languages with lots of "modality" in parsing, ie., context switching, are easier to express in generator-form (eg., antlr).
- royjacobs 6y agoWouldn't the mode be encoded in the type system via the tokens your parser is generating? I mean, every mode would be a different enum containing all the tokens that are valid in that mode?
- mjburgess 6y agoSure, I imagine it's possible to express any parser-generator grammar in combinator form. It's just a question of how easy it is to do by hand, and how efficient the parsing process would be.