Hacker News new | past | comments | ask | show | jobs | submit login

> Writing an HTML5 parser takes thousands of developers 5 years.

This is demonstrably untrue. Servo's HTML5 parser, html5ever, was largely written by a single developer within a year. (Yes, it's not a month, but it's also not 5 years.)




And wouldn’t it have been easier to write it without any of the leniency it has to expose? Wouldn’t it have been easier if all tags were either ending in /> or followed by a closing tag? Wouldn’t it have been easier if the syntax was formally defined as ABNF, and could be translated into code in a matter of days?

I believe it would have been. And I believe that making the web easier machine readable, and making it easier for people to develop tools working with the web, would be a valuable goal.


> Wouldn’t it have been easier if all tags were either ending in /> or followed by a closing tag?

Not really.

> Wouldn’t it have been easier if the syntax was formally defined as ABNF, and could be translated into code in a matter of days?

No, working from an spec written as an algorithm is easier than working from ABNF plus some inconvenient prose constraints.

(With the exception of template element support, I wrote the HTML parser used in Firefox and Validator.nu.)


> No, working from an spec written as an algorithm is easier than working from ABNF plus some inconvenient prose constraints.

That sounds very unlikely.

I’ve implemented my own parsers for countless specs – plaintext or binary, and the parsers that are written as imperative algorithms are insanely complicated to implement as functional implementations.

I end up with horrifying code, while the specs written as ABNF are much easier to translate into pattern matching code.

The specs written as algorithm only work fine for a single type of implementation IME, while the ABNF specs work equally well for all types.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: