4 ms·
"High level" is in the eye of the beholder, but I don't know that C is the best example to pick on: Before LLVM it was pretty common to target C as your portabl
by MichaelBurge 11y ago
"High level" is in the eye of the beholder, but I don't know that C is the best example to pick on: Before LLVM it was pretty common to target C as your portable assembly language.
Just to give an example, I think GHC targets C-- as one of
the steps in its transformations, and still outputs C when you're porting it to a new platform or building a cross-compiler. I don't know that it's useful to say that GHC ceases to be a compiler when you use it to target weird platforms.
And the Chicken Scheme compiler outputs C code[1] that doesn't look like a human wrote it: The C code uses a trampoline to organize function calls, and it periodically garbage-collects your stack cleaning up old frames as you call functions.
[1] http://www.more-magic.net/posts/internals-gc.html http://www.more-magic.net/posts/internals-gc.html
- masklinn 11y ago> Just to give an example, I think GHC targets C-- as one of the steps in its transformations, and still outputs C when you're porting it to a new platform or building a cross-compiler. I don't know that it's useful to say that GHC ceases to be a compiler when you use it to target weird platforms. Cmm is GHC's final intermediate language, that's then passed to the machine code generator backend: asm, llvm or C (which is now only available un unregisterised mode, which as you note is mostly for getting started on new platforms)
- e12e 11y agoThere's also Nim, which AFAIK started out by targeting C, but apparently now also support c++, objective-c and javascript backends: http://nim-lang.org/docs/backends.html#backends http://nim-lang.org/docs/backends.html#backends For more on Nim, see nim-lang.org and/or https://howistart.org/posts/nim/1 https://howistart.org/posts/nim/1