<-- Back to Andy Balaam Home

Subs

Introduction

Subs is a Scheme Lisp interpreter written in C++.

The implementation is incomplete and naive, and is intended mainly to help me understand Scheme and functional programming better. It depends on BOOST (and STL).

I aim to implement enough to be able to run every code sample in Structure and Interpretation of Computer Programs. Versions of Subs are named after the latest chapter of SICP whose code examples work correctly in the interpreter.

Subs is only tested on Linux, but should work on other platforms.

The most glaring limitations are:

Existing features include:

Points of interest:

Examples

 > (define foo 3)
 foo
 > foo
 3

 > (define (square x) (* x x))
 square
 > square
 <<COMPOUND-PROCEDURE square>>

 > (define (factorial n) (if (= n 1) 1 (* n (factorial (- n 1)))))
 factorial
 > (factorial 3)
 6
 > (factorial 4)
 24

 > (load "painter/painter.scm")
 > (define letter-a (segments->painter (list
 .     (make-segment (make-vect 0    0)   (make-vect 0.5  1))
 .     (make-segment (make-vect 0.5  1)   (make-vect 1    0))
 .     (make-segment (make-vect 0.25 0.5) (make-vect 0.75 0.5)))))
 letter-a
 > (svg-document (square-limit letter-a 4))

 

Download

Install scons, g++, BOOST and (optionally) valgrind:

 sudo apt-get install scons g++ libboost-dev valgrind

Download subs-scheme-x.x.x.tar.gz from http://sourceforge.net/projects/subs-scheme/files/ .

 tar -xzf subs-scheme-*
 cd subs-scheme-*
 scons
 ./subs

Development

To get the latest code:

 sudo apt-get install scons g++ libboost-dev valgrind

 git clone git://subs-scheme.git.sourceforge.net/gitroot/subs-scheme/subs-scheme
 cd subs-scheme
 scons
 ./subs

To browse the code:

To visit the forums or log a bug:

Copyright

Subs is Copyright (C) 2010, 2011 Andy Balaam

Subs is Free Software released under the terms of the GNU General Public License version 2 or later.

Subs comes with NO WARRANTY.

See the file COPYING.txt for more information.

Edit | History | Print | Recent Changes | Search | Admin Page last modified on February 01, 2011, at 07:29 PM