It seemed appropriate to post this today. Did this while learning lisp about two years ago. Nothing special, a pretty straight forward implementation of the original LISP paper written while reading the paper, basically.
It's difficult to describe the feeling when it clicks and the eval function comes together. All of the complexity of writing a language and an interpreter, reduced to what is basically one function that fits in a page. That is mind blowing.
Edit: I realised this works as a homage to Dennis Richie as well, as it's written in C. I did use glib for some support functions, other than that it's ANSI C.
I've been working on a MACLISP interpreter based on 80's manual I found on my fathers bookshelf. It's quite fun working backward, and seeing how the dialect influenced modern lisp.
Implementing a tiny Lisp is an exercise in learning to be a better programmer by teaching yourself how language implementations work. Creating a patch for someone else's Lisp interpreter is not a reasonable substitute.
It's not quite finished (and it's patterned after scheme rather than lisp, but that's close enough) but it runs the towers of Hanoi sucessfully. Lots of stuff still missing, tail call optimization, gc and a whole bunch of other must haves. There are likely lots of bugs too and things that don't work the way they should such as the '.
My understanding of the language is still patchy enough that it probably doesn't work in the way you expect it if you are a schemer.
One of these days I hope to do a proper job of finishing it (too much stuff to do) and do a write-up on it.
Writing this helped me tremendously in understanding the lisp family of languages.
Initially started off as a toy implementation and eventually fleshed out into a pretty nice system, used in a production environment for several years as a DSL in a perl based system.
Thanks a bunch for that tutorial! It demystified language implementation and taught me a little Haskell along the way. Oh and showed me the beauty of parser combinators.
I remember seeing your tutorial before and thinking it looked like a great exercise. Do you think it would be worthwhile for someone with a moderate Haskell background who wants to learn some Scheme? Or is it best to go into it the other way round?
I think it might be quicker to read some Scheme programs to get a feel for the language. It's usually harder to understand exactly what a program is doing by looking at the source code than it is to look at the output of the program and figure out how it got there. (This is also why I always ask for demos and changelist descriptions that explain the intent of the change when I do code reviews at work.)
Some time, it might be fun to write a Haskell interpreter in Scheme. :-) There're all sorts of cool challenges involving type inference there.
Until I went through it, I'd mostly just played with Haskell for Project Euler and other small problems. That tutorial really helped get the feel for larger projects in the language.
But at the same time, it shows off some of the elegance of lisp. It's simple enough that you can implement it as a beginner tutorial, but the end result is a surprisingly solid language.
One of the beauties of lisp is how much is possible just from some simple building blocks. That tutorial did an excellent job displaying it from the side of a language implementer rather than a language user.
Thanks a ton for it, it was really a pleasure to use.
Lisp implemented in Java. Fairly complete set of datatypes and functions, but no objects. Has been available for 10 years. http://jatha.sourceforge.net/
literally just wrote this last night and pushed it live this morning before hearing the news. I had just changed my gmail status to "season of the lisp" as I go through a seasonal fixation w/ lisp every year starting in october - when an old colleague messaged me to inform me of his passing.
50 comments
[ 3.0 ms ] story [ 107 ms ] threadEdit: I realised this works as a homage to Dennis Richie as well, as it's written in C. I did use glib for some support functions, other than that it's ANSI C.
R.I.P.
Arc-like names, python-like keyword args and indent-sensitivity.
It's been a while since I worked on it, but I think I might start again pretty soon.
Tiny stackless lisp with continuations, written in Haskell.
~150 lines of interpreter, ~40 lines of parser.
Just a half-baked implementation of a simple Scheme in C.
It's not quite finished (and it's patterned after scheme rather than lisp, but that's close enough) but it runs the towers of Hanoi sucessfully. Lots of stuff still missing, tail call optimization, gc and a whole bunch of other must haves. There are likely lots of bugs too and things that don't work the way they should such as the '.
My understanding of the language is still patchy enough that it probably doesn't work in the way you expect it if you are a schemer.
One of these days I hope to do a proper job of finishing it (too much stuff to do) and do a write-up on it.
Writing this helped me tremendously in understanding the lisp family of languages.
Don't laugh too hard at the definition of >
I haven't personally worked on it per-se, but I've worked on the compiler, JIT, and GC for the language it's implemented it :)
Initially started off as a toy implementation and eventually fleshed out into a pretty nice system, used in a production environment for several years as a DSL in a perl based system.
http://jonathan.tang.name/files/scheme_in_48/tutorial/overvi...
http://jonathan.tang.name/files/arclite/
(I didn't run very far with it but here's my code if anyone is curious: https://github.com/samsonjs/elschemo/blob/master/lisp.hs)
Some time, it might be fun to write a Haskell interpreter in Scheme. :-) There're all sorts of cool challenges involving type inference there.
Until I went through it, I'd mostly just played with Haskell for Project Euler and other small problems. That tutorial really helped get the feel for larger projects in the language.
But at the same time, it shows off some of the elegance of lisp. It's simple enough that you can implement it as a beginner tutorial, but the end result is a surprisingly solid language.
One of the beauties of lisp is how much is possible just from some simple building blocks. That tutorial did an excellent job displaying it from the side of a language implementer rather than a language user.
Thanks a ton for it, it was really a pleasure to use.
https://github.com/manuel/ell (Lisp->C compiler)
https://github.com/manuel/schampignon (Kernel interpreter in JS)
Previously, in C and to C, for the end of SICP: https://github.com/spacemanaki/lisp-in-c
http://github.com/jcoglan/heist http://fargo.jcoglan.com
If it weren't for Lisp it would never have been so easy for total noobs like me to get into language hacking.
https://github.com/ORDER-OF-NO/scphpeme
(CONS (QUOTE R) (LIST (QUOTE I) (QUOTE P)))
Lambda calculus to PPC assembly.
Just this week I got my first fork and a bunch of nice contributions.