Re:LALRPOP, an LR(1) parser generator for Rust
by royjacobs on Monday January 25, 2021 @01:16PM
(#25906613)
Wouldn'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?
Re:LALRPOP, an LR(1) parser generator for Rust
by mjburgess on Tuesday January 26, 2021 @02:03AM
(#25913303)
Sure, 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.
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).