March 01, 2005

Compiler writers vs. compiler users

Compilers can be written so that they can deal with ambiguous code, but that makes compiler writers' jobs harder, so they usually insist on precise languages. HTML parsers used to be able to handle the most distorted HTML imaginable, but XHTML (and XML) has swung things back the other way to insisting that everything be perfect, right down to not allowing quotes to be omitted around attribute values. This makes the HTML parser writers' job easier, and makes the HTML writers' job harder. Unfortunately, there are far more HTML writers than HTML parser writers, so this is a net loss. Since parser writers usually control the specs for the language, this kind of problem crops up all over the place.

Perl's TMTOWTDI philosophy is an example of how adding to compiler complexity (and annoying language theorists who would prefer an elegant language) can make the language more useful and easier to learn for the average programmer. Perl got this way partly because it was designed by enough programmers that they weren't tempted to cut any corners just to make writing the compiler a smaller job.

0 Comments:

Post a Comment

<< Home