foxscheme icon indicating copy to clipboard operation
foxscheme copied to clipboard

An R5RS Scheme in JavaScript.

FoxScheme

FoxScheme is a Scheme interpreter written in JavaScript.

Some key points include:

  • Proper support for recursion FoxScheme does not use the native JavaScript stack, which is often too small for interesting recursive problems.

  • Minimal native (primitive) procedures Only procedures that must be implemented in JS out of necessity (cons) or obvious performance reasons (expt) are native. The rest is expected to be implemented in pure Scheme, which means fewer errors in native code.

  • Cleanliness and clarity FoxScheme is split into many discrete files, each being reasonably self-contained. The code attempts to be easily-readable where possible, and commented where not, allowing for easy modification and extension.

  • Self-contained FoxScheme tries to minimize its external dependencies, and does not rely on external libraries such as jQuery or Prototype.js. FoxScheme does its best not to pollute the global namespace or otherwise interfere with other JS software. There is no dependence on a browser; for example, early development was done using Rhino. This makes FoxScheme easy to embed in a web page.

  • Error-checking FoxScheme attempts to error-check as much of the user input as is reasonable. Many JS Schemes happily accept invalid syntax and other invalid input, which can be confusing to the user.

  • Unit testing FoxScheme has a growing unit-test suite using JSSpec that is run after every atomic change to the codebase.

Known issues:

  • No arithmetic stack All numeric computation is done with JavaScript numbers, although bignum suppert could be added later.

  • Incomplete Currently, only a few native procedures are implemented for things like pairs, strings, vectors, and other basic values. There is currently no support for modules, macros, and so on. Stay tuned.

Contact:

Eric Jiang <[email protected]>

Acknowledgements and References:

Special thanks to Adam Foltzer and the people who frequent #scheme on
FreeNode. BiwaScheme, by Yutaka Hara and the other BiwaScheme contributors,
was an important inspiration and reference. Kent Dybvig's Petite Chez Scheme
system and his assorted papers have been tremendously helpful. Also notable
are Alex Yakovlev's jsScheme, Mark Probst's JScreme, and Jason Orendorff's
Try Scheme, although no code from them was ultimately used. And, of course,
The nice web-based REPL is Chris Done's jQuery Console.
  • #scheme on FreeNode irc://freenode.net/scheme

  • BiwaScheme http://www.biwascheme.org/ http://github.com/yhara/biwascheme

  • Chez Scheme http://scheme.com/

  • R. Kent Dybvig http://www.cs.indiana.edu/~dyb/

  • jsScheme http://web.archive.org/web/20080119020130/http://alex.ability.ru/scheme.html http://www.bluishcoder.co.nz/2006/05/scheme-implementation-in-javascript.html

  • JScreme http://schani.wordpress.com/2010/01/01/jscreme/

  • Try Scheme http://tryscheme.sourceforge.net/

  • jQuery Console https://github.com/chrisdone/jquery-console