Skip to content

yhara/biwascheme

 
 

Repository files navigation

BiwaScheme

biwascheme logo

BiwaScheme is a Scheme interpreter written in JavaScript.

Works with web browsers (including mobile devices) and Node.js.

Demos

see http://www.biwascheme.org/

Download

How to use

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">
(display "hello, world!")
</script>

</body>
</html>

How to use with node.js to run a biwa script

  1. $ npm install biwascheme

  2. create a file a.scm:

    (display "Hello, world!") (newline)

  3. $ biwas a.scm

How to use from inside node.js as a module

  1. $ npm install biwascheme

  2. create a file server.js:

    var BiwaScheme = require("biwascheme"); BiwaScheme.run("(+ 1 2)"); // or // BiwaScheme.run_file("a.scm");

  3. $ node server.js

Files

  • release/
    • the following files are generated here with $ make
      • biwascheme.js
      • biwascheme-min.js
      • node_biwascheme.js
  • demo/
    • Demos
  • src/
    • deps/
      • Dependencies (jQuery, underscore)
    • system/
      • Source code of the interpreter
    • library/
      • Built-in library functions
    • platform/
      • Platform dependent code (browser, node, etc.)
  • test/
    • Unit tests
  • tuplespace/
    • (experimental) TupleSpace implemented in Scheme
  • web/
  • www.biwascheme.org.js
    • web server

Building biwascheme.js

Prerequisites:

  • make
  • sed
  • node (Node.js)
  • uglifyjs ($ npm install uglify-js -g)

Make compiles src/*.js into release/biwascheme.js.

$ make

Links

Development memos

How to add a new file

  • edit Makefile
  • edit src/development_loader.js

How to release

TODO: fix this after migration to Heroku

  1. Edit History.txt
  2. Edit VERSION
  3. Edit node_modules/biwascheme/package.json
  4. $ make -B
  5. Make sure it is working:
    • run tests
      • open test/spec.html
      • open test/spec.html#release
      • open test/spec.html#min
      • run test/browser_functions/
    • run demos
      • demo/*
      • open repl.html
      • open website/i.html
      • open test/tracer.html
      • open test/tracer_auto.html
    • try npm package
      • $ npm install node_modules/biwascheme/ -g
      • $ biwas -v
  6. Commit and create tag ($ git tag x.y.z)
  7. Push changes to github with --tags
  8. Update website on web server (git pull)
  9. Publish npm package
  • $ npm publish node_modules/biwascheme/
  1. Copy generated files (release/*.js, src/version.js) to web server
  • copy src/deps/underscore(.string).js, too

How to upgrade dependencies

jQuery:

  • update src/deps/jquery.js

underscore:

  • update src/deps/underscore.js
  • update node_modules/biwascheme/package.json

underscore.string:

  • update src/deps/underscore.string.js
  • update node_modules/biwascheme/package.json

Website

www.biwascheme.org is (going to be) hosted by Heroku.

Files for website is stored in the branch 'website'. This is almost same as master, but:

  • contains compiled release/*.js and src/version.js
  • contains Procfile for Heroku cedar
  • has different package.json for Heroku
  • has different favicon.ico (master: black, website: white)

Run local website

You can run the website locally with Node and express.

$ make
$ npm install
$ node www.biwascheme.org.js
$ open http://localhost:7001

Interesting SRFIs

Partially implemented:

  • 1 list libraries
  • 13 string libraries
  • 19 time
  • 38 (write-with-shared-structure)
  • 43 vector libraries

Not yet:

  • 26 (cut)
  • 39 (parameterize) is it identical to the one in R7RS?

Maybe:

  • 41 stream
  • 42 (list-ec)
  • 44 collection
  • 48 (format) (intermediate, ~d, ~b, etc.)
  • 78 (check) -> list-ec
  • 88 keyword (like 'test:')

License

MIT-LICENSE

Acknowledgements

Contact

https://github.com/biwascheme/biwascheme

Yutaka HARA (yhara) yutaka.hara.gmail.com http://twitter.com/yhara_en

About

yhara's private clone of BiwaScheme. The official one is:

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.6%
  • Scheme 8.4%