3 ms·
Grammars are overrated—they regularly leave ambiguities and sometimes conflict with the text, despite both being considered normative. I love WHATWG specs with
by chrismorgan 7y ago
Grammars are overrated—they regularly leave ambiguities and sometimes conflict with the text, despite both being considered normative.
I love WHATWG specs with their state machines. They’re all about defining exact behaviour based upon what has already been implemented by extant software, and define comprehensively how every possible input should be parsed. They’re easy to transcribe in code without error. These things get you compatibility, and avoid security bugs where people have implemented different behaviour in different places—as was the case in this instance. As a parser spec, the HTML spec is my favourite, because it makes implementing something that is fiendishly complex genuinely easy.
I would love something equivalent for HTTP/1 and MIME messages.