
Ask HN: Clean Lisp implementation for study? - vu3rdd
I am currently learning Common Lisp and would like to study a well written Lisp Implementation for study to look inside how Lisp is implemented and also to learn the idioms of the language. What would the readers suggest? Thanks.
======
mahmud
T 3.0

<http://mumble.net/~jar/tproject/t3.0.tar.gz>

The most beautiful compiler for _any_ language.

P.S. Why not ask the specialists? the people hacking Lisp compilers for the
love of it; unpaid and unsung heroes? Drop by #lisp or #scheme in Freenode and
see who is there. Most competent Lisp compiler hackers wouldn't be caught dead
in this neck of the woods; it's just us web guys, blowhards and joe nobodies.

~~~
mahmud
Update.

I wrote various long posts here about Lisp hacking bibliography, this is the
most recent one:

<http://news.ycombinator.com/item?id=835020>

------
draven
I'm far from being an expert but "Lisp in small pieces" is frequently
recommended.

There are a lot of free/opensource implementations to study. SBCL is widely
used and ppl working on it are available in #lisp. It may be the same for
ClozureCL.

~~~
plinkplonk
""Lisp in small pieces" is frequently recommended."

Lisp In Small Pieces covers everything except the garbage collector.

Truth to tell I haven't yet seen a "how to implement a lisp" tutorial that
implements _all_ the bits - macros , gc etc. You might have to dig into source
code. SIOD is just a little crufty but it has all the pieces in very little
code.

~~~
mahmud
Wilson handles GC perfectly. LiSP is written from the perspective of
implementing Lisp in Lisp.

------
jlwjr
If you just want to understand the basics, Andru Luvisi has written an
interpreter in less than 400 lines:
<http://www.sonoma.edu/users/l/luvisi/sl5.c> and an interpreter I threw
together based off his design adding garbage collection & more ops in 500
(though the macro system is non-standard and maybe broken):
<http://codepad.org/sQvOeqN9>

------
brianm
Probably better to ask this question on lambda the ultimate ( <http://lambda-
the-ultimate.org/> )

------
clord
If you just want to understand Lisp, and not platform-specific stuff, I
recommend tackling it at a higher level.

Haskell is a great language to implement other languages in:

<http://www.defmacro.org/ramblings/lisp-in-haskell.html>

------
sunkencity
i think this article is great, i read it, then downloaded the source to
jscheme, and ported a portion of it to ruby. then i understood more about how
lisp works, i got to a working repl that had + implemented.

[http://berlinbrowndev.blogspot.com/2008/07/simple-lisp-
imple...](http://berlinbrowndev.blogspot.com/2008/07/simple-lisp-
implementation-in-java-ode.html)

then half a year later I thought what the hell and sneaked in a production app
written in clojure to one of our tomcats. for me learning something new is
always about porting it to something familiar to grok the basics and then
force myself to write real code, then there's no avoidance of those important
details

------
fogus
I wrote a version of McCarthy's original Lisp in Python if you want to study
the roots of Lisp.

<http://github.com/fogus/lithp>

~~~
bham
"I have touched on functional programming with the grace and emotion of a
lover."

I feel dirty.

BTW - I just "got" the name of your project you clever project namer.

------
vanekl
[http://www.softwarepreservation.org/projects/LISP/book/LISP%...](http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf)

Appendix B.

------
rufius
LispKit lisp is a pretty good example. A good description exists in
"Functional Programming: Application and Implementation" by Peter Henderson.

------
kbob
Scheme 9 from Empty Space is both a small Scheme implementation and a book
describing the source code. I read 60% of the book this summer, and wasn't
disappointed.

Written in portable C, it implements bignums, garbage collection,
(nonhygienic) macros, hashed environments.

<http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/>

------
CyberFonic
I actually like newLisp - not exactly Common Lisp, but I find the
implementation easy to follow. check it out on www.newlisp.org. Compiles just
about anywhere and comes with a nice testing framework so you can regression
test your changes, etc.

------
vu3rdd
Thanks for the comments. I have started looking at the provided pointers.

