this post was submitted on 29 Feb 2024
338 points (96.2% liked)

linuxmemes

20756 readers
187 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 21 points 6 months ago (13 children)

Putting a statement into old calligraphy is nice. But it all boils down to because I said so. If you're going to go to that effort you might as well put the rationale for why it can't possibly parse the language into the explanation rather than because I said so

[โ€“] [email protected] 14 points 6 months ago

The text does technically give the reason on the first page:

It is not a regular language and hence cannot be parsed by regular expressions.

Here, "regular language" is a technical term, and the statement is correct.

The text goes on to discuss Perl regexes, which I think are able to parse at least all languages in LL(*). I'm fairly sure that is sufficient to recognize XML, but am not quite certain about HTML5. The WHATWG standard doesn't define HTML5 syntax with a grammar, but with a stateful parsing procedure which defies normal placement in the Chomsky hierarchy.

This, of course, is the real reason: even if such a regex is technically possible with some regex engines, creating it is extremely exhausting and each time you look into the spec to understand an edge case you suffer 1D6 SAN damage.

load more comments (12 replies)