From: ····················@hotmail.com
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <cee3dab4-112b-4230-9959-fc8d2c0e3583@g20g2000vba.googlegroups.com>
On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:

> I would like to convert some Common LISP into C language. Is there a
> consolidated way to do that?

well in theory, yes you can convert Lisp to C but it may be pretty
hard in some places. You may be better off asking in comp.lang.lisp
(I've x-posted it there). The first thing they may ask is "why do
you want to do this?". I think (but am not sure) there are Lisp->C
compilers. I doubt the resulting C is very readable tho'

> I am not an experienced programmer in both languages, but I know more C
> than LISP.


--
Nick Keighley

 Meanwhile Steele famously claims Java is halfway to Lisp.
 Perhaps he meant starting from the stone axe?
        -- Ken Tilton

From: Piotr Chamera
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <gu8pqs$ckj$1@news.onet.pl>
····················@hotmail.com pisze:
> On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
> 
>> I would like to convert some Common LISP into C language. Is there a
>> consolidated way to do that?
> 

You can look at ECL, it is Common Lisp implementation
which compiles to C as intermediate step in compilation.
From: Gene
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <9c325578-e747-4ef6-a4ff-51b7a4886af1@u10g2000vbd.googlegroups.com>
On May 11, 5:06 am, Piotr Chamera <·············@poczta.onet.pl>
wrote:
> ····················@hotmail.com pisze:
>
> > On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>
> >> I would like to convert some Common LISP into C language. Is there a
> >> consolidated way to do that?
>
> You can look at ECL, it is Common Lisp implementation
> which compiles to C as intermediate step in compilation.

Also GNU Common Lisp.
From: namekuseijin
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <gua0mc$soc$1@adenine.netfront.net>
Gene escreveu:
> On May 11, 5:06 am, Piotr Chamera <·············@poczta.onet.pl>
> wrote:
>> ····················@hotmail.com pisze:
>>
>>> On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>>>> I would like to convert some Common LISP into C language. Is there a
>>>> consolidated way to do that?
>> You can look at ECL, it is Common Lisp implementation
>> which compiles to C as intermediate step in compilation.
> 
> Also GNU Common Lisp.

If he plans to actually maintain the C code so generated, low-level and 
full of insane macro manipulations, it'll be a friggin' pain.

Should be much easier to either learn Lisp and maintain said Lisp code 
or to manually translate it from Lisp to C, in which case he has to 
learn Lisp anyway and halfway through it may just enjoy the language 
best. ;)

-- 
a game sig: http://tinyurl.com/d3rxz9
From: Pascal J. Bourguignon
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <87iqk7xu63.fsf@galatea.local>
Gene <············@gmail.com> writes:

> On May 11, 5:06�am, Piotr Chamera <·············@poczta.onet.pl>
> wrote:
>> ····················@hotmail.com pisze:
>>
>> > On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>>
>> >> I would like to convert some Common LISP into C language. Is there a
>> >> consolidated way to do that?
>>
>> You can look at ECL, it is Common Lisp implementation
>> which compiles to C as intermediate step in compilation.
>
> Also GNU Common Lisp.

Which one?

-- 
__Pascal Bourguignon__
From: Francogrex
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <5520810a-ec94-4744-81d7-039a4a77cdb9@h23g2000vbc.googlegroups.com>
On May 11, 11:06 am, Piotr Chamera <·············@poczta.onet.pl>
wrote:
> ····················@hotmail.com pisze:
>
> > On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>
> >> I would like to convert some Common LISP into C language. Is there a
> >> consolidated way to do that?
>
> You can look at ECL, it is Common Lisp implementation
> which compiles to C as intermediate step in compilation.

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)
From: Chun Tian (binghe)
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <a875a027-ffcd-40f0-b7c6-050419822ef3@k9g2000pra.googlegroups.com>
On May 12, 6:40 am, Francogrex <······@grex.org> wrote:
> On May 11, 11:06 am, Piotr Chamera <·············@poczta.onet.pl>
> wrote:
>
> > ····················@hotmail.com pisze:
>
> > > On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>
> > >> I would like to convert some Common LISP into C language. Is there a
> > >> consolidated way to do that?
>
> > You can look at ECL, it is Common Lisp implementation
> > which compiles to C as intermediate step in compilation.
>
> 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
From: Mark Tarver
Subject: Re: is it possible to convert LISP to C?
Date: 
Message-ID: <5c21d6f0-18cb-45d3-97f6-e5cccf3ad4d9@q14g2000vbn.googlegroups.com>
On 11 May, 09:30, ····················@hotmail.com wrote:
> On 11 May, 09:17, "FSX" <··········@webuse.net> wrote:
>
> > I would like to convert some Common LISP into C language. Is there a
> > consolidated way to do that?
>
> well in theory, yes you can convert Lisp to C but it may be pretty
> hard in some places. You may be better off asking in comp.lang.lisp
> (I've x-posted it there). The first thing they may ask is "why do
> you want to do this?". I think (but am not sure) there are Lisp->C
> compilers. I doubt the resulting C is very readable tho'
>
> > I am not an experienced programmer in both languages, but I know more C
> > than LISP.
>
> --
> Nick Keighley
>
>  Meanwhile Steele famously claims Java is halfway to Lisp.
>  Perhaps he meant starting from the stone axe?
>         -- Ken Tilton

Look at CLiCC: http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/impl/clicc/0.html

I've never used this btw.

Mark