Jump to content


Amplifying C with Lisp


4 replies to this topic

#1 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 29 January 2010 - 04:38 PM

I just thought I should share this link.

http://voodoo-slide....plifying-c.html

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.

#2 Mihail121

    Senior Member

  • Members
  • PipPipPipPip
  • 1059 posts

Posted 29 January 2010 - 08:19 PM

edit:

Sorry, I misinterpreted the article.

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 5311 posts
  • LocationSanta Clara, CA

Posted 29 January 2010 - 09:03 PM

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. :)
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 29 January 2010 - 11:39 PM

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.

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 5311 posts
  • LocationSanta Clara, CA

Posted 29 January 2010 - 11:43 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users