From: Trevis Rothwell
Subject: clisp question -- compiling to C
Date: 
Message-ID: <36ACE4C6.6DE9@QUALITY.SPAMLESSNESS.TREET>
Hi.

Whilst browsing the 'clisp' "man" page, I
noticed something that seemed to indicate
that 'clisp' can convert Lisp code to C. Is
this true, and if so, how is it done?

Thanks!

-Trevis Rothwell
 ···@acm.org

From: charliew
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <78jbt0$rcv$1@news.hal-pc.org>
Hopefully, this isn't a stupid followup question.  Is there such a thing as
a Lisp to Pascal compiler?  If so, where can I find it, and how much does
this beast cost?

Yes, I realize that most people don't use Pascal any more, but the system at
work is chock full of this stuff (Arrrrgggggghhhhh!)

P.S.  Please reply in email.  The chance of my finding a reply to this
newsgroup is nowhere near 100% probability.

Clemens Heitzinger wrote in message ...
Trevis Rothwell <·······@QUALITY.SPAMLESSNESS.TREET> writes:

> Hi.
>
> Whilst browsing the 'clisp' "man" page, I
> noticed something that seemed to indicate
> that 'clisp' can convert Lisp code to C. Is
> this true, and if so, how is it done?

CLISP doesn't compile to Lisp code to C, but to byte code.

It's speed is ok.  It is very fast at doing bignum arithmetic.
Actually, according to some crude benchmarks I did a long time ago, it
was by far the fastest Common Lisp and Scheme implementation when it
came to bignums.

Anyway, if you want a Lisp to C compiler, you can buy Eclipse Common
Lisp, or get GCL (outdated), or ECL (built on GCL afaik).  The latter
two aren't ANSI compliant at all.

Yours,
Clemens
--
Clemens Heitzinger
Student der Techn. Mathematik, Technische Universit�t Wien, �sterreich
Vienna University of Technology, Austria
http://ag.or.at:8000/~clemens
From: Marco Antoniotti
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <lw4spewf3d.fsf@copernico.parades.rm.cnr.it>
Trevis Rothwell <·······@QUALITY.SPAMLESSNESS.TREET> writes:

> Hi.
> 
> Whilst browsing the 'clisp' "man" page, I
> noticed something that seemed to indicate
> that 'clisp' can convert Lisp code to C. Is
> this true, and if so, how is it done?
> 

CLISP stands for Common Lisp (I think!) so C is not involved. Besides,
why would you like to convert (Common) Lisp to C, when you have native
compilers at hand?

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - (0)6 - 68 10 03 17, fax. +39 - (0)6 - 68 80 79 26
http://www.parades.rm.cnr.it
From: Hrvoje Niksic
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <8790eqfgvk.fsf@pc-hrvoje.srce.hr>
Marco Antoniotti <·······@copernico.parades.rm.cnr.it> writes:

> CLISP stands for Common Lisp (I think!) so C is not
> involved. Besides, why would you like to convert (Common) Lisp to C,
> when you have native compilers at hand?

Because he runs on a platform not supported by the (free) native
compilers?
From: Trevis Rothwell
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <36ADE5D9.36B2@QUALITY.SPAMLESSNESS.TREET>
Marco Antoniotti wrote:

> CLISP stands for Common Lisp (I think!) so C is not involved. Besides,
> why would you like to convert (Common) Lisp to C, when you have native
> compilers at hand?

In my case, "clisp" is the Common Lisp interpreter/compiler
that I am using. It may very well stand for "Common Lisp",
but I am refering to the program, not the language.

I want to convert Common Lisp to C so that I can compile
the program(s) to run on computers where Common Lisp
interpreters/compilers may not exist. Even on the various
flavours of Unix (BSD, GNU/Linux, Solaris, etc.) not
everyone installs a Lisp interpreter/compiler, but they
usually install a C compiler. Therefore, if I were to
give a program to someone to compile it on their computer,
it would make more sense for it to be in C.

Certainly, I know C, but I enjoy programming in Lisp
more than C.

-Trevis Rothwell
 ···@acm.org
From: Hrvoje Niksic
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <87zp76ouhe.fsf@pc-hrvoje.srce.hr>
Trevis Rothwell <·······@QUALITY.SPAMLESSNESS.TREET> writes:

> I want to convert Common Lisp to C so that I can compile the
> program(s) to run on computers where Common Lisp
> interpreters/compilers may not exist.

That can't work becauwe Common Lisp programs normally rely on the
run-time system to be there.  For example, when an error condition
occurs, the runtime error system will ask the user what to do, etc.

I guess it should be possible to extract the runtime system into a
form of "library", but then you'd have to ship the library with your
program, which is not far from shipping the entire interpreter.

If you simply want to distribute binaries to people who don't have the
interpreter installed, most Lisps allow you to "dump" the memory image
(your program along with the runtime system) and produce a standalone
binary.
From: Duane Rettig
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <4k8y99arb.fsf@beta.franz.com>
Trevis Rothwell <·······@QUALITY.SPAMLESSNESS.TREET> writes:

> I want to convert Common Lisp to C so that I can compile
> the program(s) to run on computers where Common Lisp
> interpreters/compilers may not exist. Even on the various
> flavours of Unix (BSD, GNU/Linux, Solaris, etc.) not
> everyone installs a Lisp interpreter/compiler, but they
> usually install a C compiler. Therefore, if I were to
> give a program to someone to compile it on their computer,
> it would make more sense for it to be in C.

Availability is becoming less of a reason to compile lisp to C
as time goes on. It used to be that C compilers were standard
issue on most machines, but now, even on the old standards
(sparc, hp, etc.) you have to buy the C compiler; it is not
necessarily factory-installed nor is it installed automatically
as part of the os installation.  And lisps are coming out on
more and more machines all the time.  Of course, availability
and convenience are two different things, and it is always more
convenient to have a compiler installed on a machine than to
have to go out and look for it, whether it be C, lisp, or any
other language.

If you must make an availability argument, you're going to have
to be specific, since otherwise I think you are (incorrectly)
generalizing.  Of course, I admit that not _all_ machine/os
combinations have lisp availability, so a specific complaint
about a specific architecture would be helpful to us vendors,
in knowing what people like to use.

> Certainly, I know C, but I enjoy programming in Lisp
> more than C.

Good.  You should pursue that, instead of trying to convert from
the language you enjoy to the language you enjoy less.

-- 
Duane Rettig          Franz Inc.            http://www.franz.com/ (www)
1995 University Ave Suite 275  Berkeley, CA 94704
Phone: (510) 548-3600; FAX: (510) 548-8253   ·····@Franz.COM (internet)
From: Trevis Rothwell
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <36AE058A.1E6B@QUALITY.SPAMLESSNESS.TREET>
Hi.

Okay then, to clarify what it is that I am asking,
here is a portion of the "clisp" "man" page:

--
FILES
       clisp  startup script
       lisp.run
              main executable
       lispinit.mem
              initial memory image
       config.lsp
              site-dependent configuration
       *.lsp  lisp source
       *.fas  lisp code, compiled by clisp
       *.lib  lisp source library information, generated and used
              by the clisp compiler
       *.c    C code, compiled from lisp source by clisp
--

The last line seems to indicate that "clisp" can compile
Lisp code to C code. So the question is, is this true,
and how is it done?

-Trevis Rothwell
 ···@acm.org
From: Erik Naggum
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <3126370826200330@naggum.no>
* Trevis Rothwell <·······@QUALITY.SPAMLESSNESS.TREET>
|        *.c    C code, compiled from lisp source by clisp
| 
| The last line seems to indicate that "clisp" can compile Lisp code to C
| code.  So the question is, is this true, and how is it done?

  that's the C files that make up the Lisp runtime system.

#:Erik
-- 
  SIGTHTBABW: a signal sent from Unix to its programmers at random
  intervals to make them remember that There Has To Be A Better Way.
From: Bruno Haible
Subject: Re: clisp question -- compiling to C
Date: 
Message-ID: <78t6hi$9c2$1@news.u-bordeaux.fr>
Trevis Rothwell asks about the meaning of:
>
> FILES
>       *.lsp  lisp source
>       *.fas  lisp code, compiled by clisp
>       *.lib  lisp source library information, generated and used
>              by the clisp compiler
>       *.c    C code, compiled from lisp source by clisp

Most Lisp files are compiled into bytecode (*.fas) only. FFI definitions,
however, like DEF-C-TYPE and DEF-C-CALL-OUT, are compiled to C code. This
C code must then be compiled to object code by the user, before it can
be used in subsequent clisp invocations (via `clisp-link run').

For an example, see the modules/regexp/ directory in the CLISP source.

                   Bruno                         http://clisp.cons.org/~haible/