Re:Coconut: Simple, elegant, Pythonic functional programming
by jimsimmons on Thursday November 04, 2021 @09:46AM
(#29107112)
Procedural version is more verbose and quite long. That's the downside but it's also the reason why it'd be more readable and maintainable. Procedural version would actually be very similar to a parser combinator with elementary parsers being things like `while str[i].isalphanumeric(): i++`.
[ Parent
| on HN ]
Re:Coconut: Simple, elegant, Pythonic functional programming
by gliptic on Thursday November 04, 2021 @10:19AM
(#29107515)
Or you could write it as a PEG (or indeed parser combinators) that would be even easier to read. I don't buy that verbosity on its own makes something readable and maintainable.
Re:Coconut: Simple, elegant, Pythonic functional programming
by jimsimmons on Thursday November 04, 2021 @10:39AM
(#29107762)
Imagine comparing diffs of a verbose parser vs diff between two complex regexes. The parser one could be 10x larger or even more, but it'd have a tractable diff. In the regex case I'd have to mentally keep track of column numbers and a bunch of other things.