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.
T 3.0<p><a href="http://mumble.net/~jar/tproject/t3.0.tar.gz" rel="nofollow">http://mumble.net/~jar/tproject/t3.0.tar.gz</a><p>The most beautiful compiler for <i>any</i> language.<p>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.
I'm far from being an expert but "Lisp in small pieces" is frequently recommended.<p>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.
If you just want to understand the basics, Andru Luvisi has written an interpreter in less than 400 lines: <a href="http://www.sonoma.edu/users/l/luvisi/sl5.c" rel="nofollow">http://www.sonoma.edu/users/l/luvisi/sl5.c</a>
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): <a href="http://codepad.org/sQvOeqN9" rel="nofollow">http://codepad.org/sQvOeqN9</a>
Probably better to ask this question on lambda the ultimate ( <a href="http://lambda-the-ultimate.org/" rel="nofollow">http://lambda-the-ultimate.org/</a> )
If you just want to understand Lisp, and not platform-specific stuff, I recommend tackling it at a higher level.<p>Haskell is a great language to implement other languages in:<p><a href="http://www.defmacro.org/ramblings/lisp-in-haskell.html" rel="nofollow">http://www.defmacro.org/ramblings/lisp-in-haskell.html</a>
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.<p><a href="http://berlinbrowndev.blogspot.com/2008/07/simple-lisp-implementation-in-java-ode.html" rel="nofollow">http://berlinbrowndev.blogspot.com/2008/07/simple-lisp-imple...</a><p>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
I wrote a version of McCarthy's original Lisp in Python if you want to study the roots of Lisp.<p><a href="http://github.com/fogus/lithp" rel="nofollow">http://github.com/fogus/lithp</a>
<a href="http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf" rel="nofollow">http://www.softwarepreservation.org/projects/LISP/book/LISP%...</a><p>Appendix B.
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.<p>Written in portable C, it implements bignums, garbage collection, (nonhygienic) macros, hashed environments.<p><a href="http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/" rel="nofollow">http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/</a>
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.