A Lisp Interpreter in 170 Lines of Perl Code

A few years ago, I was on a train from Eindhoven to Utrecht; this should have been a ride of less than an hour, but thanks to various mishaps (“ladies and gentlemen, it turns out that the replacement engine is also broken, so we’ll be here a little longer”), it took me almost five hours to get home that day.

Fortunately I had my laptop with me, so to while away the time I wrote a very simple Lisp interpreter in Perl. Recently, while looking through some old back-ups, I came across it again.

Here it is: the interpreter and a test file. To run the test program, execute: perl minilisp.pl test.l

Needless to say, this is a toy. If, for any reason, you need a real Lisp interpreter in Perl, check out perl-lisp on CPAN, by Gisle Aas.