4 ms·
Why do this? compile to native code directly if anything. Would you transform it to C first so you could edit the C? Then what if you want to make a big update
by goggles99 14y ago
Why do this? compile to native code directly if anything. Would you transform it to C first so you could edit the C? Then what if you want to make a big update using the Closure source? it will overwrite your changes.
This approach is not practical, perhaps I am failing to understand any logic as to why you would go with this approach. Portability (between processor architectures) is all I can think of but you will never achieve high performance if this is the case.
C coders write their code differently against different processors because all machines have different capabilities and resources (strength and weaknesses).
- spacemanaki 14y agoCompiling to C is not at all an uncommon strategy, there's at least one pretty serious Scheme implementation [1] that does this. Portability between architectures is a pretty big advantage, but in this case another one is leveraging the Boehm GC, rather than rolling your own. Could you use the Boehm GC if you emitted assembly? I would guess maybe it's possible, but you'd have to emit assembly that followed C calling conventions, I would imagine. Emitting C might be easier. Lisp in Small Pieces has a pretty big chapter that goes into detail how to compile Lisp to C. [1] http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_Page http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_P... see also: http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/90-min-scc/90-min-scc.pdf http://www.iro.umontreal.ca/~boucherd/mslug/meetings/2004102... http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/minutes-en.html http://www.iro.umontreal.ca/~boucherd/mslug/meetings/2004102...
- takeoutweight 14y agoin clojure-scheme I actually compile Clojure to Gambit to make use of Gambit's awesome runtime. It's a very good match for Clojure. https://github.com/takeoutweight/clojure-scheme https://github.com/takeoutweight/clojure-scheme
- dons 14y agoC has been widely used as a "portable" target language. LLVM is increasingly used as a more semantically-sane alternative.