Re:Multicore OCaml: September 2020
by Joker_vD on Friday October 09, 2020 @01:56PM
(#24732543)
While re-using an existing regexp like
is easier than writing a tokenizer manually (keeping track offsets and looping and stuff), writing that regexp is definitely harder than writing the tokenizer like this:
Yeah, it's more verbose and somewhat repetitive, but on the other hand, it's way more readable, and debuggable too: with regexps, it's always a mystery which part of it exactly didn't match what you wanted or captured something you didn't want to match. Here, the loop invariants and preconditions are almost immediately obvious.
[ Parent
| on HN ]