-> Software by Joe Ganley -> JavaScript Lisp Interpreter

JavaScript Lisp Interpreter

by Joe Ganley

[Introduction] | [Language Spec] | [Copying]



I wanted to get a feel for just how powerful JavaScript is as a programming language (as opposed to just a scripting language), so I sat down one evening and wrote this. It turns out that it was quite good for this application, since it is so flexible - dynamically sized arrays are used throughout, and associative arrays make the symbol table quite easy.

A fairly complete set of Lisp instructions are implemented (see below). The choice of instructions and some of the implementations of the composite functions were taken from Roger Rohrbach's Lisp in Awk interpreter. The syntax is standard, and only integer arithmetic is available. This is Lisp, not Scheme - scoping is dynamic.

Since this is pretty much a toy, it doesn't do much in the way of error handling. However, it should work on correct Lisp code; if it breaks on code you believe to be correct, please send me mail at

To see the source code, just View-Source on this page; but see the copying restrictions below.

The interpreter implements the following instructions as primitives:

In addition, the following are defined as composite functions; i.e. they're defined in Lisp itself as functions of the above primitives.

You are free to copy this code and modify it as you wish, provided that (a) my header comment in the code is not removed, (b) you make apparent as both a comment in the code and visibly on the web page that contains it that you have modified it, and (c) the following message appears visibly on the web page that contains the code:

The HTML code to produce this message: