4 ms·
An alternative to seeking better language APIs. Parsing regex then pretty-printing the parse tree as s-expressions is very legible. You can also print the pars
by JonChesterfield 3y ago
An alternative to seeking better language APIs.
Parsing regex then pretty-printing the parse tree as s-expressions is very legible. You can also print the parse tree as the original syntax. Postfix will work better for some people, I like the lispy look for parse trees.
Most regex are similar syntax over a parse tree with different parts missing, if you keep track of roughly what features the current engine has in your head the sema checking a real compiler should do could be deferred or incomplete.
Some coding standards will want redundant escapes because that is considered more readable, could put that logic in the pretty-printer.
That's sort of suggesting using your IDE to translate the thing back and forth on the fly instead of persuading colleagues to stop writing in the obfuscated format.