geon at January 29th, 2010 11:38 — #1
I just thought I should share this link.
While I don't have that much experience with neither C nor Lisp, being able to generate plain low-level C while having the advantage of the high-level functional Lisp seems awesome.
mihail121 at January 29th, 2010 15:19 — #2
Sorry, I misinterpreted the article.
reedbeta at January 29th, 2010 16:03 — #3
Very interesting. I've contemplated the idea of having a high-level language compile to C as a target language before, but never seen a complete system that does it. It's certainly a useful idea if you want to create your own language generally (not just Lisp-based things). As the article points out, C compilers/libraries exist for just about every platform out there, so by compiling to C your language is immediately cross-platform (assuming you only need cross-platform libraries) and gets the benefit of very mature optimizers, code generators and suchlike.
As for Lua, uh, what? Of course, you could write a Lua-to-C compiler too if you liked.
geon at January 29th, 2010 18:39 — #4
Well, it's not really compiling Lisp to C.
You would actually write C code in Lisp syntax, giving you access to the extremely powerfull Lisp macro system. That way you can do stuff like resource management and exception handling by transforming the C code.
You would then compile your Lisp-ish C into plain C.
reedbeta at January 29th, 2010 18:43 — #5
Writing "C code in Lisp syntax" sounds pretty much like writing Lisp to me. Yeah, maybe you'd have calls to the C standard library instead of the Lisp one, but that's a minor detail.