3 ms·
I don't think anyone would claim that HTML was easy to parse, would they? It took decades for the HTML5 consensus to emerge. I like text-based formats, but I'm
by mrec 9y ago
I don't think anyone would claim that HTML was easy to parse, would they? It took decades for the HTML5 consensus to emerge.
I like text-based formats, but I'm not convinced that "Being non-binary is a huge plus" for parsing. With binary formats you can assume that documents are generated by a tool, which is at least trying to be compliant with a spec, so barfing on noncompliance is more acceptable. With text you have to be prepared to cope with any kind of rat dance imaginable.
- tannhaeuser 9y agoParsing semistructured text as markup is a problem solved over 30 years ago [1]. SGML has the SHORTREF feature which allows custom Wiki syntaxes such as markdown, but also casual math. It works by applying a context-dependent (parent element dependent) mapping of tokens (such as the `_` token for markdown emphasis) to replacement text (eg. the `<b>` start-element tag). Within the `<b>` context, the `_` token is mapped to the `</b>` end-element tag, in turn, ending the emphasis. In combination with tag omission/inference (such as in HTML) and other markup minimization and processing features, SGML is a quite powerful plain text document authoring format. [1]: https://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language https://en.wikipedia.org/wiki/Standard_Generalized_Markup_La...
- mrec 9y agoWe may be talking about different things. Parsing valid, standard-conforming HTML/Markdown/whatever is a solved problem. Getting multiple parsers to deal with arbitrary tag soup, authoring errors, variously-supported extensions etc in a consistent way is a lot uglier. The problems may be commercial/political/educational/organizational rather than technical, but that doesn't mean they aren't real.
- tannhaeuser 9y agoI'd say that's exactly what SGML is about - a meta language to describe those things consistently.