2 ms·
It’s not just the syntax. Regex isn’t directly composable (unless you just mash together strings). They cannot define nested structures, I.e. no recursion. They
by aranchelk 2y ago
It’s not just the syntax. Regex isn’t directly composable (unless you just mash together strings). They cannot define nested structures, I.e. no recursion. They can’t maintain context.
We don’t need better language tools. Better parsers can, and already have, been implemented in libraries.
I’d have a look at parser combinators.
- dur-randir 2y ago(?R) is very much recursion in there.
- johnisgood 2y ago> They can’t maintain context. Is true though, or perhaps "state"? I know I had to come up with an algorithm because regexp alone couldn't do what I wanted (not even advanced features like lookahead, lookbehind, etc.)
- davidwritesbugs 2y agoI played with parser combinators in Elm and found it very useful c.f. regexes - the issues were mainly down to the Elm implementation. Not sure how effective they are in Rust or Go