Skip to content

Comment on (How to Write a (Lisp) Interpreter (in Python))

Comments

Oh, for crying out loud! Have you no sense of history? The whole point of Lisp and Scheme is that you can write the interpreter in Lisp or Scheme! It's a sad day when you have to write a Lisp interpreter in Python, which is itself an interpreter written in C.

God has killed so many kittens because of you. ;-)

Is it turtles all the way down?

Well, the benefit of writing a Lisp-ish interpreter in Lisp is that you can focus on the semantics, rather than how things like garbage collection, type tagging, and symbol interning are implemented. When using another language, the relevant infrastructure might not already be lying around, but you can take advantage its novel features instead.

That may be valuable, but there's value in this too.

I've had a play this morning, and am already most of the way towards having the readline sitting in twisted and the instance feeding a webserver. Which is to say - lisp notation with all the benefit of python's great libraries, and I understand the layers completely.

No kittens were killed.

I wasn't the one who said the trite thing about kittens - I think writing toy interpreters and compilers is a great way to figure out how languages work.

yeah ... that was my point ... it's a tradition to write Lisp in Lisp / Scheme in Scheme but it's also a testimony to the simplicity of Lisp 1.0. The actual first functioning Lisp interpreter was written in IBM 704 assembler, but once that was done, everything else from that day forward could have been done in Lisp. A fair amount of it was, once macros and Lisp compilers showed up.

Lisp is not particularly unique in that regard. Forth is even simpler (perhaps too simple), and it's not that hard to write a naive implementation of Joy or Tcl.

Besides, piggybacking off the existing Lisp implementation doesn't help much when you're trying to figure out how the infrastructure (GC, etc.) is implemented. I learned a LOT implementing a Scheme interpreter in OCaml a couple years ago, and wouldn't discourage anyone from doing so in whatever language they feel most comfortable with. (I'm actually taking a break from writing a small compiler right now, for a proprietary database query language we need to convert.)

I think you are/were mostly being voted down because of your tone.

Relax :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.