Write C as s-expressions
- http://voodoo-slide.blogspot.com/2010/01/amplifying-c.html
- http://www.unmutual.info/software/scexp/
Related:
- http://news.ycombinator.com/item?id=1071222
- http://www.thinlisp.org/whitepaper.html
- http://www.bitc-lang.org/
- http://en.wikipedia.org/wiki/PreScheme
- http://neontology.com/posts/2007/08/11/whats-nu
How do you mean? Something along the lines of:
(c-expression (int main ((int argc) ((array (pointer char)) argv) (block (printf "%d arguments\n" argc) (if (argc >= 1) (printf "The first arg is %s\n" (ref argv 1))) (return 0)))) => "int main (int argc, char *argv[]) { printf("%d arguments\n", argc); if (argc >= 1) printf(The first arg is %s\n", argv[1]); return 0; }
If so, yes, it's definitely doable. However, it's not entirely trivial.
Perhaps you want something like ECL, which compiles Common Lisp to C.