3 ms·
this seems really awesome, but I have no idea what it does? I know that Python compiles to C and that Clojure compiles to JVM (or even to JavaScript). My cart
by mrcactu5 13y ago
this seems really awesome, but I have no idea what it does?
I know that Python compiles to C and that Clojure compiles to JVM (or even to JavaScript).
My cartoon:
scripting lang --> programming lang --> native code
Honestly, I have never experimented with Assembly language much except for COOL (http://en.wikipedia.org/wiki/Cool_(programming_language) http://en.wikipedia.org/wiki/Cool_(programming_language)) and TOY (http://introcs.cs.princeton.edu/java/52toy/ http://introcs.cs.princeton.edu/java/52toy/).
- JulianWasTaken 13y agoPython does not compile to C. In CPython, it compiles to VM bytecode for a VM written in C (analogous to Closure compiling to JVM bytecode).
- elehack 13y agoPython does not compile to C (well, there might be such a compiler, but it is not the standard mode of operation). In CPython, Python compiles to bytecode, which is then interpreted by the Python interpreter (which itself is written in C).
- gsnedders 13y agoRPython, the Python subset that PyPy is written in, is compiled to C. (That said, it is a fairly restrictive subset, and the compiler is very much designed for interpreters and nothing else.)
- tel 13y agoWhen compiling a language you have to compile it "to" somewhere. You could pick assembly, but assembly is so low level that it changes bit by bit depending on the processor. You want a stable target that's "low level" enough to let you optimize things for the machine you'll be working with, but not so low level as to be a moving target. You could pick C, but C is actually still fairly complex and has lots of undefined behavior. You could pick JVM, but then you'll pick up the entirety of the JVM architecture which is quite large and may include many things you're not interested in. C-- is another choice. It's decidedly lower-level than C (and thus far lower than JVM), higher level than assembly, and was crafted, as far as I know, under the deep influence of how to compile the pure functional language Haskell (or more specifically, it's System FC style and STG underlying languages). In the mean time, LLVM took a similar place in this hierarchy and has probably taken off much more than C-- has. GHC, a Haskell compiler, in fact is moving its compilation pathway that way.