3 ms·
> Take the hard problem of parsing a language, break it down into the much simpler problem of reading tokens, then write simple "combinators" (and, or, one_or_m
by thaumasiotes 2y ago
> Take the hard problem of parsing a language, break it down into the much simpler problem of reading tokens, then write simple "combinators" (and, or, one_or_many, etc etc) to combine these simple parsers into larger more complex parsers.
That's a terrible example for "parser combinators beat regexes"; those are the three regular operations. (Except that you use zero_or_many in preference to one_or_many.)
- mrkeen 2y agoCan I see the (implied) counter-example? A regex which turns a language's source code into an AST?
- thaumasiotes 2y agoWhat implied counterexample? Regular expressions define the simplest language type a CS education generally covers. You would expect anything to be more capable. But you wouldn't prove it by demonstrating that you can recognize regular languages. That's the thing regular expressions are good at!