Ask HN: Clean Lisp implementation for study?
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.
13 comments
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.
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.
Update.
I wrote various long posts here about Lisp hacking bibliography, this is the most recent one:
http://news.ycombinator.com/item?id=835020
I wrote various long posts here about Lisp hacking bibliography, this is the most recent one:
http://news.ycombinator.com/item?id=835020
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.
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.
""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.
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.
Wilson handles GC perfectly. LiSP is written from the perspective of implementing Lisp in Lisp.
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
Probably better to ask this question on lambda the ultimate ( http://lambda-the-ultimate.org/ )
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
Haskell is a great language to implement other languages in:
http://www.defmacro.org/ramblings/lisp-in-haskell.html
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...
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
http://berlinbrowndev.blogspot.com/2008/07/simple-lisp-imple...
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.
http://github.com/fogus/lithp
http://github.com/fogus/lithp
"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.
I feel dirty.
BTW - I just "got" the name of your project you clever project namer.
LispKit lisp is a pretty good example. A good description exists in "Functional Programming: Application and Implementation" by Peter Henderson.
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/
Written in portable C, it implements bignums, garbage collection, (nonhygienic) macros, hashed environments.
http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/
[deleted]
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.
Thanks for the comments. I have started looking at the provided pointers.