top | item 35327525

(no title)

serjeem | 2 years ago

> Insisting it's a deep, dark magic and not the advanced application of `str.replace` does the industry a disservice.

Respectfully, this perspective contradicts the computer science underlying our work--there are in fact different categories of string "languages" that can be parsed using different technologies, and regular expressions are not enough for most "languages".

See https://en.wikipedia.org/wiki/Chomsky_hierarchy for the different categories of languages and the required tech to parse them.

I consider CS theory to be about the deepest and darkest magic I get to use on a daily basis :P.

> The only difference is layers. Enough regular expression becomes a parser. A slim enough compiler is just a templating engine.

You can't add enough layers of standard regex to parse, say, C++ or even a tree of matching parenthesis. You need a different tech like CFGs.

Hope this helps improve the grokking! The "interesting meat" here actually points at some really deep, fundamental CS theory that's really worth knowing.

discuss

order

musingsole|2 years ago

"regular expression" != "regular language"

I appreciate the academic frameworks that have led to the development of systems, however as a working engineer, ignoring where the rubber meets the road is my entire complaint.