Re:Reparse – A comprehensive parser combinator for OCaml
by aryx on Friday December 04, 2020 @02:51AM
(#25300039)
This is nice, but when your language will grow, why would you use that instead of lex/yacc? It's hard to beat a nice BNF grammar; In fact they felt the need to put the BNF grammar for the things they were parsing at the end of the README, because it's far more readable that those >* skip <* stuff.
Re:Reparse – A comprehensive parser combinator for OCaml
by chrisseaton on Friday December 04, 2020 @04:18AM
(#25300472)
A good thing about parser combinators like this is that they’re unambiguous by construction.
I also find them much more controllable and manageable in practice. I think that’s a common experience with imperative parsing in general, as it’s the approach used in I’d say the majority of industrial compilers.
> It's hard to beat a nice BNF grammar; In fact they felt the need to put the BNF grammar
The BNF grammar there is incomplete compared to their actual code, it’s just a sketch it doesn’t completely describe the accepted language, so hard to argue it’s better as you wouldn’t be able to do anything with it!
Re:Reparse – A comprehensive parser combinator for OCaml
by thedufer on Friday December 04, 2020 @05:17AM
(#25300816)
What's the advantage of this over existing OCaml parser-combinator libraries? The "Why Use Reparse?" section really sells parser-combinator libraries in general; as far as I can tell, it applies equally to all of angstrom, mparser, opal, and planck.
I also find them much more controllable and manageable in practice. I think that’s a common experience with imperative parsing in general, as it’s the approach used in I’d say the majority of industrial compilers.
> It's hard to beat a nice BNF grammar; In fact they felt the need to put the BNF grammar
The BNF grammar there is incomplete compared to their actual code, it’s just a sketch it doesn’t completely describe the accepted language, so hard to argue it’s better as you wouldn’t be able to do anything with it!
I much prefer parser combinators over anything else I've tried that generates code.
https://discuss.ocaml.org/t/ann-reparse-2-0-0/6868/5