|Designing a calling convention for a Lisp->C compiler firstname.lastname@example.org (Manuel) (2010-06-03)|
|Re: Designing a calling convention for a Lisp->C compiler email@example.com (Marc van Lieshout) (2010-06-03)|
|Re: Designing a calling convention for a Lisp->C compiler firstname.lastname@example.org (russell kym horsell) (2010-06-04)|
|Re: Designing a calling convention for a Lisp->C compiler email@example.com (russell kym horsell) (2010-06-06)|
|Re: Designing a calling convention for a Lisp->C compiler firstname.lastname@example.org (BGB / cr88192) (2010-06-06)|
|Re: Designing a calling convention for a Lisp->C compiler email@example.com (Robbert Haarman) (2010-06-07)|
|Re: Designing a calling convention for a Lisp->C compiler firstname.lastname@example.org (Gene) (2010-06-06)|
|From:||russell kym horsell <email@example.com>|
|Date:||Fri, 4 Jun 2010 04:24:50 +0000 (UTC)|
|Keywords:||C, Lisp, translator, comment|
|Posted-Date:||04 Jun 2010 12:21:20 EDT|
Manuel <firstname.lastname@example.org> wrote:
> Hello group!
> I am building a Lisp to C compiler. I don't know very much about the
> lowlevel details of things like stdarg, so I it is rather unclear for
> me how to go about making this as efficient as possible.
The "bull at a gate" approach doesn't work very well for
While some very simple LISP programs -- i.e. written by people that
normally program in C or whatever -- may be relatively straightforward to
turn (back:) into C.
But LISP programmers generally make so much use of the "data == program"
idea that no simple translation is practical.
The tried-and-true method is to decide on some kind of abstract machine
that can execute programs in the language you have in mind (e.g. SECD machine),
translate your applicative language efficiently into THAT (normally quite
a trick, but a worthy learning experience :), and then -- possibly --
write each "machine instruction" in the abstract machine as a C macro
and -- thence -- have a system that can compile your applicative language.
There are many books on compiling functional languages such as ML, Miranda or
even one or other dialect of LISP/Scheme. Give some a skim.
And maybe check out the FAQ at comp.lang.functional for further pointers
on compiling same.
Good luck. :)
[I dunno. People have been compiling Lisp into machine code quite successfully
since the mid 1960s. -John]
Return to the
Search the comp.compilers archives again.