“Lispsy” Lisp(ish) to C Converter (designed for CLISP)

LISP/c is a powerful macrolanguage for C. It basically turns this:

(header stdio)
(@printf (str “Hello, world!”))
(return 0))
into (after it being cleaned up (more on this later)) this:


int main(int argc,char **argv)
printf(“Hello, world!”);
return 0;

But why?

First, you might check out this video. Because LISP is expressive and C is fast and I wanted the best of both worlds is the short answer. The longer answer has something to do with macros. But instead of immediately boring you with that, I’ll answer what you really want to know:

Why Should I Care?

First let’s discuss if you can use it. Not to be elitist (I wish everyone would use this tool), but you must know both C and LISP fairly well to be able to use LISP/c.

Suppose, however, that you do already know both LISP and C pretty well. You might want to use LISP/c because it features access to LISP to write C code both implicitly and explicity. You might also want to use it if you like writing CUDA code, because it has built-in support for CUDA as well.

But really, to see why you might like to use LISP/c, check out a few examples, and feel free to skip around a little.