C interpreter in Lisp/scheme/python

Rivka Miller rivkaumiller at gmail.com
Wed Jul 7 12:38:40 EDT 2010


On Jun 13, 4:07 pm, bolega <gnuist... at gmail.com> wrote:
> I am trying to compare LISP/Scheme/Python for their expressiveness.
>
> For this, I propose a vanilla C interpreter. I have seen a book which
> writes C interpreter in C.
>
> The criteria would be the small size and high readability of the code.
>
> Are there already answers anywhere ?
>
> How would a gury approach such a project ?
>
> Bolega

You should probably narrow down your project to one. For example,
write a LISt Processor Meta Circular Evaluator in C.

You can take Paul Graham's rendition as a start and forget about
garbage collection.

Start with getchar()/putchar() for I/O.

Although C comes with a regex library, you probably do not need a
regex or parser at all for this. This is the beauty of LISP which is
why McCarthy was able to bypass the several man years of effort
involved in FORmula TRANslator. Even as a young boy like L. Peter
Deutsch was able to write it in assembly for one of the PDP's.

You will have go implement an associative array or a symbol-value
table probably as a stack or linked list. You will have to decide how
you implement the trees, as cons cells or some other method. Dynamic
scoping is easy to implement and that is what elisp has. I am not
aware of any book that provides implementation of LISP in C and
explains it at the same time.

This is the extent of help I can provide, someone else can probably
help you more.

Anyone know what the first initial of L. Peter Deutsch stand for ?

Rivka




More information about the Python-list mailing list