<-- 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 https://codeberg.org/andybalaam/subs-scheme/releases .

 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 https://codeberg.org/andybalaam/subs-scheme.git
 cd subs-scheme
 scons
 ./subs

To 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 November 04, 2022, at 08:12 PM