Re:Direct Clojure to C Compiler - Based on ClojureScript
by spacemanaki on Monday July 09, 2012 @03:17PM
(#4219881)
Compiling 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_P...
see also:
http://www.iro.umontreal.ca/~boucherd/mslug/meetings/2004102...
http://www.iro.umontreal.ca/~boucherd/mslug/meetings/2004102...
Re:Direct Clojure to C Compiler - Based on ClojureScript
by takeoutweight on Monday July 09, 2012 @06:49PM
(#4221016)
in clojure-scheme I actually compile Clojure to Gambit to make use of Gambit's awesome runtime. It's a very good match for Clojure.
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).