Minimal Scheme Interpreter

SICP-inspired Scheme interpreter in Javascript

Download as .zip Download as .tar.gz View on GitHub

Minimal Scheme interpreter in JavaScript

Based on (metacircular Scheme) evaluator in Structure and Interpretation of Computer Programs (SICP)

what it is

an interpreter for a lexically-scoped, minimalist-designed, dialect of lisp

it is initially nowhere close to R5RS- or R6RS-complient

the following operands (in alphabetical order) are implemented

at the momemnt you need to implement cons, car and cdr yourself using lambda. :)

how it works

It basically works by doing two things ->

  1. to evaluate a combination (a compound expression other than a special form), it evaluates the subexpressions and then applies the value of the operator subexpression to the values of the operand subexpressions.
  2. to apply a compound procedure to a set of arguments, it evaluates the body of the procedure in a new environment. To construct this environment, it extends the environment part of the procedure object by a frame in which the formal parameters of the procedure are bound to the arguments to which the procedure is applied.

in-browser example (evaluates each keypress)

input:
output: