Skip to content

vrescobar/ShenScript

 
 

Repository files navigation

Shen Version Build Status Docs Status

Shen for JavaScript

An implementation of the Shen Language by Mark Tarver for JavaScript. Full documentation can be viewed at shenscript.readthedocs.io.

Features

  • Allows integration with arbitrary I/O.
  • Async operations are transparent to written Shen code.
  • Easy interop: JS can be called from Shen, Shen can be called from JS.
  • REPL works on command line in Node.js.
  • Fairly small deployable (~633KB uncompressed, ~76KB compressed).

Still in progress:

  • Speed up async performance (sync test suite time: ~24s, async: ~72s).
    • Web startup time is ~2s on Chrome, ~75s on Firefox in async mode.
  • Speed up web load time (current ~2s). Disable declare type checks?
  • Pre-supply helpful async I/O implementations for loading in WebWorker, command line, etc.

Prerequisites

Requires recent version (10+) of Node.js and npm as well as webpack-cli locally installed and http-server if you want to run the demo.

Building and Testing

Refer to .travis.yml for typical build/test process. test-* commands are optional.

Running

Demo Page

Run the following commands in order to host a simple demo page:

npm install           # Get npm dependencies
npm start             # Start webpack watch
http-server -p 8080   # Host the page

If you open a browser on localhost:8080 a basic webpage will load, and when ready, it will display the load time.

If you open the JavaScript console in the developer tools, it is possible to access to the shen global object and execute commands:

shen.exec("(+ 1 1)").then(console.log);

Chaining the then call is necessary because the environment will be built in async mode and exec will return a Promise.

For more information refer to the documentation.

REPL

Run npm run repl to run a command-line REPL. It should have the same behavior as the shen-cl REPL. node. functions will be available.

Execute (node.exit) to exit the REPL.

Command-line options not yet implemented.

About

Shen for JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.2%
  • Python 1.4%
  • HTML 0.4%