Advertisement

Minimal Lisp implementation?

Started by September 14, 2005 10:29 AM
4 comments, last by fur 19 years, 2 months ago
I'm thinking of implementing my own lisp interpreter for scripting purposes and such. I'm trying to determine the minimal built in function required. And then when that is implemented implementing the others with those base functions. The list so far is: listp (or list?) numberp (or number?) null (nil?) list append car cdr <,>,<=,>=,/=,= +,-,\,* defun cond (or simply if) if (or just cond) I don't know if this would be sufficient or not. Any ideas are help full, thanks, L- Edit: Forgot defun
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net
First of all: numbers are for weaklings, real man use church numerals ;)

If your lisp should be anything like Scheme or Common Lisp you need (set stuff value), (lambda ...), (eval ...) and (apply ...).

You don't need defun, list and append. You most likely need (cons ...). For anything useable you need a GC.

A nice book on this topic is Lisp in small pieces.
Advertisement
Read John McCarthy's original paper on lisp here. It covers pretty much everything needed for a minimal implementation of lisp.

If you mean Common Lisp, the book ANSI Common Lisp actually has a (somewhat complete - it's missing lots of error checking and that kind of thing) lisp implementation in the back based on something like 30 primitives listed at the start of that section.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Thank you -- both of you. Those are some excellent resources for the task. I haven't yet got a chance to read McCarthy's paper. Also, the Lisp In Small Parts, looks like a good book, I orderred it, and will find out.

Thanks,
L-
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net
http://www.paulgraham.com/lib/paulgraham/jmc.ps

A pretty interesting paper, alot easier to follow than the original (well, to the untrained eye).

Another good link in general is http://www.readscheme.org

Not many people realize that today's &#106avascript is like Scheme in disguise. Heck, you might even know the syntax already! Also, there are implementations already done that integrate directly with Java anc C.<br>
http://www.p2pmud.com

This topic is closed to new replies.

Advertisement