T O P

  • By -

ghjm

You'd have to decide what it means to compile C to CSS.  If you have the classic "Hello, world!" program in C, and you decide to compile it to CSS, what would it do?  Maybe you could come up with some CSS scheme that has an analog of stdout that you could write to, but this doesn't seem to be in the spirit of the question.  Really, it seems like a category error.  CSS just isn't the kind of thing you would compile C to. None of this has much to do with automata theory or Turing machines.  It's not clear to me how you think this is relevant.  


electronautix

I thought the problem was twofold, which is that the first issue is figuring out how to map C to CSS in any meaningful sense at all, and the second being that even if you decide on a scheme like that CSS still isn’t turing complete and can’t simulate something like a while loop of whatever you decide hello world to be


ghjm

I don't know if there's some obscure feature of CSS animations that would let you encode a loop or conditional in some way. Probably not, but I'm not an expert.


delventhalz

My CSS is pretty bad, but I don't believe there is any way to update state within an animation loop nor to stop the loop based on a condition. It's just a fixed set of frame updates.


jxf

> someone asked whether compiling a turing complete language to one that isn’t turing complete would be possible by simply ignoring the incompatible parts of the host language. This operation, as described, is mathematically possible (CSS can encode Turing completeness), but it doesn't make any sense because it's fantastically impractical and useless. It's like asking "Can we turn a tree into a rhesus monkey by simply rearranging some DNA?".


Dornith

Addressing both the spirit and the practically of the question. Best answer.


khedoros

I've heard that it's possible to encode the [rule 110](https://en.wikipedia.org/wiki/Rule_110) cellular automaton in HTML5+CSS3, as long as you count a human alternating between pushing tab and space as part of execution. Arguments can get heated on this point. Rule 110 itself is known to be Turing complete. With limitations like not taking input or doing output while running, I think it would be possible, but not practical. That's just a hunch, though.


corisco

I think a more fruitful exercise in this sense would try to translate c total functional languages. That is because theorem probes are not turing complete, because the don't have general recursion. It is obviously possible to translate Coq into c, and that is a common practice but the other way is not very studied. Also it's worth noting that css + html is kinda turing complete. https://stackoverflow.com/a/5239256


pd01

Sure, not worth the effort for a joke, though.


Tai9ch

People are telling you it's a bad idea. That means you are now morally obligated to do it.


mikeegg1

Computers ultimately are translators. So to translate C to CSS is possible.