4 ms·
I suggest you take a look at parser combinators. They are quite readable compared to regexes
by perceptronas 4y ago
I suggest you take a look at parser combinators. They are quite readable compared to regexes
- bawolff 4y agoSo is SNOBAL. i don't disagree that long regexes are difficult to read only that real programmers dont really value that compared to conciseness (in practise anyways, people always claim to value readability, but their actions often differ)
- hans1729 4y agoI queried google for '"SNOBAL" acronym' and am no wiser than before, what do you mean? Also, I like to think of myself as a "real" programmer and I take great care to produce readable code :-)
- puzzlingcaptcha 4y agoParent comment probably meant SNOBOL.
- hans1729 4y agoThank you. For the uninitiated: https://en.wikipedia.org/wiki/SNOBOL https://en.wikipedia.org/wiki/SNOBOL see the second paragraph.
- rocqua 4y agoThey are totally different solutions. A regex is just a fast, usually integrated into the language, universally understood way to do some simple parsing. Parser combinators are an amazing specialized tool for building parsers, but one that is generally harder to integrate into a code-base (outside of e.g. Haskell), requires lesser known libraries, and is a paradigm that people need time to get used to. It's like saying people shouldn't use a mitre-box [1] and instead use a full fledged circular mitre-saw [2]. Yes the second tool is much more versatile, powerful and useful. But it requires much more setup, skill and investment to actually use. [1] https://en.wikipedia.org/wiki/Mitre_box https://en.wikipedia.org/wiki/Mitre_box [2] https://www.toolstation.com/power-tools/mitre-saws/c317 https://www.toolstation.com/power-tools/mitre-saws/c317