[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

small scheme implementation.

I have done a demonstration implementation called SIOD, "Scheme In One
Defun" originally in zetalisp, but now in C.  A reasonable effort was
made to keep the size and complexity down. The result is one file
under 20 thousand bytes. 

 * (double) floating pointer numbers, +,-,*,/,>,<,eql
 * symbols, oblist
 * lists, cons,car,cdr,setcar,setcdr, assq, copy-list, eq.
 * define,set!,lambda,quote,if,progn
 * garbage collection, (copy style), heap size fixed on startup.
 * control-c quit interrupt, floating point exception handler.
 * Ran on 4.2BSD and VAX/VMS

It is very easy to add new subrs and special forms (e.g. cons-stream),
which I plan to do, up to 5000 bytes worth. The current version is
available by anonymous ftp from bu-it.bu.edu in /pub/siod.c
I hope the small size and straightfoward implementation make it
easy for interested parties to port it to their microcomputers.
Let me know if you have any problems.

The implementation is moderately fast, with (fib 20) on an Encore
Multimax taking 3.5 times longer in Cscheme than in SIOD. On a
SUN4-280 SIOD did (fib 20) in 4.1 seconds, consing about 100 thousand cells.

N.B. I like to time fib with:
 (define (fib x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2)))))