jscert / jsexplain

Apache License 2.0
26 stars 4 forks source link

JSExplain

This repository is not maintained anymore. It moved here : https://gitlab.inria.fr/star-explain

An (unofficial) ECMAScript Reference Interpreter and Double-debugger.

Building

Dependencies

The minimum system dependencies are:

Optional dependencies:

Installation and test with OPAM

opam switch create jsexplain 4.04.2
eval $(opam env)

opam pin -yn add JS_Parser "https://github.com/resource-reasoning/JS_Parser.git#v0.1.0"
opam install -y JS_Parser

opam repository add jsexplain https://github.com/jscert/opam-repository.git#add-pkg-fjs_of_fml

opam install -y jsexplain

firefox .opam/jsexplain/share/jsexplain/driver.html 

If you intend to run the test262 test suite:

make test_init

Building

To build all default targets:

make

You can run the tool locally by opening the driver.html page. (make open is a shortcut for this).

To test jsjsref using test262:

make test

Toplevel Make Targets

Testing

To select subsets of tests to run you can use the -g flag with the pattern to grep for in the test name. Each test262 test case's path is a part of the test name. For example, to select only the interpreter run test cases for the if statement, you could use: npx mocha -g 'test/language/statements/if.*interprets'

Latest version of jsjsref & debugger is automatically published at: https://jscert.github.io/jsexplain/branch/master/driver.html

Architecture

The source code for the interpreter is primarily written in a subset of OCaml with supporting runtime libraries written in both OCaml and JS.

The source code is located in the jsref directory. It can either be built using the standard OCaml compiler (to produce a result we term mljsref), or using a custom OCaml-to-JS compiler which is located in the generator directory (we term the resulting product jsjsref).

Details about the custom compilation are provided in the generator directory.

To simplify presentation of the code, a monadic binder syntax extension is used. This is also described in the generator directory.