It has been claimed many times that modern CSS is Turing complete – that is, it is a full programming language that you can use to do anything. Now we have more proof – a web page with nothing but CSS that runs x86 assembler.
In principle, the web consists of HTML, CSS and JavaScript. HTML provides the layout of the page, the CSS styles it and the JavaScript provides the actions. This is a neat organization, but things got out of hand when it comes to CSS. It seems that styling a web page – colors, fonts, simple graphical shapes – is so demanding that CSS has to be a complete programming language.
Really? In an ideal world CSS (Cascading Styles Sheets) would be as actionless as possible because that is what JavaScript is for and a web page doesn’t need two programming languages. In general, domain-specific languages like CSS should be designed specifically not to be Turing complete – i.e. not bw a complete programming language.
As stated in the introduction, it has been said before that CSS is Turing complete, which isn’t a good thing. Now we have an amazing proof that not only it IS Turing complete, it is a fairly powerful language. has gone to the insane effort of implementing the 8086 machine instruction set using nothing but CSS. OK, this isn’t the full 64-bit nightmare of the current crop of Intel processors, but it was good enough to run MS-DOS and more back in the day. It is a proper machine language, if somewhat limited by today’s standards. So, yes, this really is a computer implemented using only CSS and as, we know that x86 is Turing complete, CSS must also be Turing complete.
As well as being a demonstration of the status of CSS as Turing complete, is also fun to interact with using its numbered buttons. There is a text display and underneath a display of the current register contents and the current address being executed. This is indeed entertaining, but it does emphasize how slow the whole thing is. As the author says, it isn’t going to run Doom any day now.
So what is the point?
None at all, but let the author answer that question. In the FAQ’s she states:
You were so preoccupied with whether or not you could that you didn’t stop to think if you should
idk why everybody keeps saying that, obviously i thought about whether i should first and came to the conclusion that it would be fun and cool asf to do it
If you would like to waste some time creatively, then it is good to know that it can run your assembly language program, or even your C program if you use a compiler that outputs the right form of assembler.
In this day of AI taking over every programming task, it is nice to know that humans can make a break for freedom by doing things that no right-minded AI would ever consider…
More Information
Related Articles
To be informed about new articles on I Programmer, sign up for our ,subscribe to the and follow us on or .
Comments
or email your comment to: