From: Creighton Hogg
Subject: What compiler to study?
Date: 
Message-ID: <Pine.LNX.4.58.0512091103040.677@login01.hep.wisc.edu>
Hi guys,
I want to start getting into how common lisp is/can be 
implemented, so what would be a good common lisp 
implementation to start delving into?  I'm guessing that 
some are more cleanly written than others.

From: Bill Atkins
Subject: Re: What compiler to study?
Date: 
Message-ID: <1134158369.473306.108370@g49g2000cwa.googlegroups.com>
Creighton Hogg wrote:
> Hi guys,
> I want to start getting into how common lisp is/can be
> implemented, so what would be a good common lisp
> implementation to start delving into?  I'm guessing that
> some are more cleanly written than others.

I'd guess that CLISP is probably the most straightforwardly-implemented
Common Lisp.  It supports an interpreted mode, so that would probably
be the first place to start.  CMUCL and SBCL are designed to emit
highly optimized machine code, so that's bound to be more complex than
a simple interpreter implementation.

In general, if you want to get familiar with how Common Lisp works/is
implemented, I would suggest starting with Scheme since it is much
easier to implement whole interpreters for Scheme than for Common Lisp.
 A great book on this topic is Structure and Interpretation of Computer
Programs, by Abelson and Sussman; the full text is available for free
at MIT Press.  

Bill
From: Bulent Murtezaoglu
Subject: Re: What compiler to study?
Date: 
Message-ID: <87k6ee86pc.fsf@p4.internal>
>>>>> "CH" == Creighton Hogg <······@login01.hep.wisc.edu> writes:

    CH> Hi guys, I want to start getting into how common lisp is/can
    CH> be implemented, so what would be a good common lisp
    CH> implementation to start delving into?  I'm guessing that some
    CH> are more cleanly written than others.

I know this is not what you asked, but I thought it wouldn't hurt to
point out Lisp in Small Pieces is a good _book_ to look at.  Here's the 
Amazon link:

http://www.amazon.com/gp/product/0521562473/103-7187391-2095813

cheers,

BM
From: Waldek Hebisch
Subject: Re: What compiler to study?
Date: 
Message-ID: <dndq5b$b7l$1@panorama.wcss.wroc.pl>
Creighton Hogg <······@login01.hep.wisc.edu> wrote:
> Hi guys,
> I want to start getting into how common lisp is/can be 
> implemented, so what would be a good common lisp 
> implementation to start delving into?  I'm guessing that 
> some are more cleanly written than others.

If you want something really simple then look at an interpreter. Also
you may wish to start with Scheme, since Scheme was designed to be
easy to implement.

If you really want a compiler generating machine code (and for "full"
Common Lisp) then Poplog Clisp is probably the simplest one. Poplog
lacks optimizations present in CMUCL or SBCL but that makes it much
simpler. Also, while IMHO internals of no free List are really well
documented Poplog documentation may be the best.

If you want to focus on Lisp Poplog has a drawback: most of Poplog
is written in Pop11. Pop11 is Lisp-like, but uses infix notation.

-- 
                              Waldek Hebisch
·······@math.uni.wroc.pl 
From: elof
Subject: Re: What compiler to study?
Date: 
Message-ID: <pan.2005.12.10.14.05.00.855129@image.dk>
Den Fri, 09 Dec 2005 11:06:15 -0600. skrev Creighton Hogg:

> Hi guys,
> I want to start getting into how common lisp is/can be 
> implemented, so what would be a good common lisp 
> implementation to start delving into?  I'm guessing that 
> some are more cleanly written than others.


Do not study one of the major lisp compilers as your first step. Instead
read "Structure and Interpretation of Computer Programs" followed by "Lisp
In Small Pieces". They describe how lisp interpreters, compilers, garbage
collecters etc. can and have been built. 

They contain several lisp
implementations ranking from a few pages and up to a handfull of pages of
source code, that are crafted with teaching you how lisp implementations
works as the main goal.

	Kristian
From: Thomas A. Russ
Subject: Re: What compiler to study?
Date: 
Message-ID: <ymioe3mnr3k.fsf@sevak.isi.edu>
elof <····@image.dk> writes:

> 
> Den Fri, 09 Dec 2005 11:06:15 -0600. skrev Creighton Hogg:
> 
> > Hi guys,
> > I want to start getting into how common lisp is/can be 
> > implemented, so what would be a good common lisp 
> > implementation to start delving into?  I'm guessing that 
> > some are more cleanly written than others.
> 
> 
> Do not study one of the major lisp compilers as your first step. Instead
> read "Structure and Interpretation of Computer Programs" followed by "Lisp
> In Small Pieces". They describe how lisp interpreters, compilers, garbage
> collecters etc. can and have been built. 
> 
> They contain several lisp
> implementations ranking from a few pages and up to a handfull of pages of
> source code, that are crafted with teaching you how lisp implementations
> works as the main goal.
> 
> 	Kristian

Seconded.  This is a good recommendation for how to proceed.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Rob Warnock
Subject: Re: What compiler to study?
Date: 
Message-ID: <nc6dnS9JBO5tkz3enZ2dnUVZ_t2dnZ2d@speakeasy.net>
elof <····@image.dk> wrote:
+---------------
| Do not study one of the major lisp compilers as your first step. Instead
| read "Structure and Interpretation of Computer Programs" followed by
| In Small Pieces". They describe how lisp interpreters, compilers,
| garbage collecters etc. can and have been built. 
+---------------

There's also a simple Scheme compiler written in Common Lisp in
chapters #22 & #23 of Peter Norvig's "Paradigms of Artificial
Intelligence Programming: Case Studies in Common Lisp" [known
around here as "PAIP", see <http://www.norvig.com/paip.html>].
It generates byte-codes for a very simple hypothetical stack
machine: starts with a simple version, then adds tail call
optimization, then CALL/CC, then finally adds some peephole
optimization. The web site has the source code. I'd probably
suggest reading it between SICP & LiSP.

But I agree that if you're serious about compiling, Queinnec's
LiSP is a must!


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Jens Axel Søgaard
Subject: Re: What compiler to study?
Date: 
Message-ID: <439f5ae0$0$38659$edfadb0f@dread12.news.tele.dk>
Creighton Hogg wrote:
> I want to start getting into how common lisp is/can be 
> implemented, so what would be a good common lisp 
> implementation to start delving into?  I'm guessing that 
> some are more cleanly written than others.

Besides reading LiSP, you can read the source of the
small Scheme compiler for the Sparc written for
a workshop:

     <http://www.cs.indiana.edu/eip/compile/>

The source is well written. It includes a small interpreter
for Sparc machine code, so one can run the compiler even on
non-sparc machines.

For papers on Scheme/Lisp compilers see

     <http://library.readscheme.org/page8.html>

One paper that will enhance your understanding of the
workshop compiler is

   R. Kent Dybvig, Robert Hieb and Tom Butler.
   "Destination-Driven Code Generation".
   Indiana University Computer Science Department.
   Technical Report #302. February 1990.
   <http://www.cs.indiana.edu/~dyb/papers/ddcg.ps>

-- 
Jens Axel S�gaard