2016-12-24

Long-time Slashdot reader
kruhft brings news about a new S-Expression based language transpiler that has the feel of C.
This structure allows for the creation of code generation macros using the full power of the host Common Lisp environment, a language designed for operating on S-Expressions, also known as Lists. It is unknown exactly what power might come about from this combination of low level processing with high level code generation.

This has prompted some
discussion online about
other
attempts to
convert Lisp to C -- raising several more questions. How (and why) would you convert your Lisp code into C, and what would then be the best uses for this capability?

How?

By Gravis Zero



2016-Dec-24 17:16

• Score: 4, Funny
• Thread

Weeping and at gunpoint. ;)

Re:Excellent

By dgatwood



2016-Dec-24 17:29

• Score: 5, Funny
• Thread

I'm suddenly reminded of the Russian spy who tried to steal the source code for the American missile defense system. When he got home, he discovered that he had nothing but three pages filled with close parentheses. "The bad news," the spy said, "is that we only got the last three pages, and they contain no useful code. The good news is that we now know what language it was written in."

Lisp to C

By jbolden



2016-Dec-24 17:35

• Score: 3
• Thread

How (and why) would you convert your Lisp code into C

Well that's pretty easy. There are tons of simple Lisp compilers. Heck building a LISP used to be an exercise for many years included (full source) with Microsoft's C compiler.

A few examples:
http://www.buildyourownlisp.co...
http://howtowriteaprogram.blog...
http://sbcl.sourceforge.net/
http://clisp.sourceforge.net/

A little off topic but a Lisp in Java by a master of the programming craft which is worth looking at: http://norvig.com/jscheme.html
And finally also off topic but the original LISP in assembly: http://www.softwarepreservatio...

In short the way you convert LISP to C is writing a LISP interpreter or compiler.

Facebook

By darkain



2016-Dec-24 21:12

• Score: 3
• Thread

Facebook already did this with PHP. It was called HipHop. But it sucked. Too many issues, and it didnt solve enough issues. Luckily, Facebook started over from scratch, and just built of PHP virtual machine that does JIT compilation instead of needing to compile PHP into C then into machine language, and the result is actually a faster product, which supports more of the PHP language, and is a hell of a lot more stable (still not perfect though)

So, why bother cross-compiling to another language? Just build a LISP JIT VM system. Solve all your problems! :D

Editing changed the question, unfortunately

By kruhft



2016-Dec-24 22:47

• Score: 3
• Thread

I'm glad this story got posted and sxc is getting some press, but the real question I asked was:

It is unknown exactly what power might come about from this combination of low level processing with high level code generation. Can you think of any possible uses?

The idea of using pre-processors to generate C code is not new to programming; but the usage of the full power of Common Lisp in such a natural way is up to the question.

Show more