True, but forget about having a readable C code, you won't even have a
"standalone" C code (meaning you wouldn't be able to compile and run
on any PC, unless you have some lispy dll sand libraries to use)
If there's still some people who remember it, the "Chestnut Lisp->C
translator" is the best here. It can translate ANSI Common Lisp
(included CLOS) source code into human readable C code. However, these
translated C code would reference some CL functions which exist in a C-
based runtime (source code supplied). The Lisp->C translation progress
itself is all done by Common Lisp code (running in other modern CL
platform). Here is a trivial example:
(in-package :tcl-user)
(defun triangle (n)
(labels ((iter (i acc)
(if (zerop i) acc
(iter (1- i) (+ acc i)))))
(iter n 0)))
Translation results:
#include "user.h"
#include "triangle.h"
/* ITER */
static Object triangle_iter(i,acc)
Object i, acc;
{
Object temp = UNBOUND, temp_1;
Declare_stack_pointer;
Object result;
SAVE_STACK();
PROTECT_3(temp,acc,i);
if (zerop(i)) {
RESTORE_STACK();
return VALUES_1(acc);
}
else {
temp = sub1(i);
temp_1 = add(acc,i);
RESTORE_STACK();
return VALUES_1(triangle_iter(temp,temp_1));
}
}
/* TRIANGLE */
Object triangle(n_1)
Object n_1;
{
return VALUES_1(triangle_iter(n_1,FIX(0)));
}
void triangle_INIT()
{
Object Qtriangle;
SET_PACKAGE("TCL-USER");
Qtriangle = STATIC_SYMBOL("TRIANGLE",Pcl_user);
SET_SYMBOL_FUNCTION(Qtriangle,STATIC_FUNCTION(triangle,NIL,FALSE,
1,1));
}
The C version is readable, but not for manually maintain. It can be
compiled with other C source code in real applications. Unfortunately
it's not a public software any more. Oracle acquired it in 1995, and
several companies still have right to use it. For it's history, see
this post:
http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/9d83095a6a644e86/b0f989d317d7eea5
I'm still in maintaining Chestnut (as part of a job in one of those
"several companies") and adding some modern features to it. Maybe
there will be one day it goes public again. You can just wait.
--binghe