1. Brian Thorne
  2. pyscheme


A very (very) basic scheme interpreter. Originally adapted from Peter Norvig's tutorial, have used the BiwaScheme Interpreter found at repl.it as my reference implementation.

lis.py> (define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))
lis.py> (fact 2)
lis.py> (fact 8)
lis.py> (define a 4)
lis.py> (* a (+ a (* a a)))

Example Usage

Currently there are two ways to interact with pyscheme.

Command Line

The first is via the command line interpreter "lis.py":

pyscheme$ python lis.py

An extremely sophisticated Ctr-D or Ctr-C exit mechanism has been implemented ;-)

File evaluation

For evaluating lisp files just pass the filename as an argument:

pyscheme$ python lis.py lisp/cond.s


The tests document the features I've implemented and can be run with:

pyscheme$ python -m test.test_lib

Wish List

  • Add unit tests that execute a more complex lisp program.
  • Implement verbosity command line flag
  • Fix my parser to deal with "multi part strings"
  • Implement "let"
  • Implement the define-syntax
  • Proper tear down for each test that resets the namespace and flushes stdout and stdin.
  • ...get the interpreter through the PyPy translator.


During development I've been using Python2.7 and PyPy 1.9.