BiwaScheme is a Scheme interpreter written in JavaScript.
Works with web browsers (including mobile devices) and Node.js.
see http://www.biwascheme.org/
(Or you can just copy the file from ./release
.)
Just load biwascheme.js (or biwascheme-min.js) and write Scheme code.
<!DOCTYPE html>
<html>
<body>
<div id="bs-console"></div>
<script src="biwascheme.js"></script>
<script type="text/biwascheme">
(display "hello, world!")
</script>
</body>
</html>
-
$ npm install -g biwascheme
-
create a file a.scm:
(display "Hello, world!") (newline)
-
$ biwas a.scm
-
$ npm install biwascheme
-
create a file a.js:
var BiwaScheme = require("biwascheme"); BiwaScheme.run("(+ 1 2)"); // or BiwaScheme.run_file("a.scm");
-
$ node a.js
The npm package contains biwascheme.mjs
for module bundlers like rollup. See https://github.com/acmiyaguchi/svelte-biwascheme-example for an example.
Note that biwascheme.mjs does not include jQuery unlike biwascheme-x.y.z.js. You need to bundle jQuery manually if you want to use functions defined in src/library/webscheme_lib.js.
You need Node.js (tested with v16.5.0) and npm (tested with v7.20.1) to build biwascheme.js.
See doc/dev/build.md.
Prerequisites: Node.js, npm
$ npm install
$ npm run serve
- Open http://localhost:7001/test/spec.html
- Test release/biwascheme.js
- Test release/biwascheme-min.js
- Test browser specific functions
$ cd test/browser_functions && node server.js && open http://localhost:7002/
- Test node specific functions
- $ npm run node-test
BiwaScheme implements most of the features of R7RS small, including first-class continuation and tail call optimization.
Major lacking features are:
- syntax-rules
- Exceptions
- Library system
There are two limitations that arise from JavaScript. These will not be fixed (it's technically possible to fix but will be very inefficient).
- Strings are immutable
- Integers are not distinguished from float
MIT-LICENSE
BiwaScheme logo by @jcubic: Creative Commons Attribution 3.0
-
Kent Dyvbig, Three implementation models for scheme
-
jsScheme
- http://alex.ability.ru/scheme.html (inavailable/web.archive.org)
-
ExplorerCanvas (demo/excanvas.js)
https://github.com/biwascheme/biwascheme
Yutaka HARA (yhara) yutaka.hara.gmail.com http://twitter.com/yhara_en