Domanda

Is it possible to write a compiler in HTML+CSS? I know that they (together) are supposedly Turing complete, at least the HTML5/CSS3 combo. So it should be possible to write a compiler for, say, Java in it right? Or do I have some sort of fundamental misunderstanding of what Turing completeness means? Since HTML+CSS are not compiled languages themselves does this mean it is impossible to write a compiler in them? (Could you also write a compiler for HTML/CSS?)

È stato utile?

Soluzione

While it is possible to implement some Turing-equivalent systems (such as Rule 110 - http://eli.fox-epste.in/rule110-full.html) in HTML and CSS alone, the resulting implementation cannot be used as a computer in any useful sense. It has an extremely high overhead, and would take an absolutely gigantic web page to perform even very simple computations (e.g, adding together small numbers) with. A Java compiler would be utterly impossible.

Take-home lesson here: Not all "Turing-complete" systems are equal. There are vast differences in how efficiently they can get work done.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top