Skip to content
Javascript Interpreter, in Rust
JavaScript Rust Other
Branch: master
Clone or download

Latest commit

Latest commit 702c162 Jan 29, 2017

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
report
sputnik
src
.gitignore
.travis.yml
Cargo.lock
Cargo.toml
LICENSE
README.md
parse.py
test_results.txt

README.md

js.rs Build Status

A JavaScript interpreter written in Rust.

2015-2016 senior design project by Terry Sun and Saghm Rossi, in collaboration with David Mally (for his Master's Thesis) and Professor Steve Zdancewic.

Our poster and report are included in PDF form under report/ for convenience.

Structure

The parser is currently defined in a secondary package at rustoscript/js.rs-parser, and the AST is defined at rustoscript/js.rs-common. The garbage collection engine is implemented by David Mally at rustoscript/french-press.

Instructions

Build and run with Cargo. By default, this opens a REPL.

cargo build
cargo run

You can pass in a JS file to evaluate code from a file.

cargo run <file>

Run the Sputnik test suite:

cargo run -- --test

Evaluation

Js.rs was tested using Google's Sputnik, an ECMAScript 5 conformance test suite. Sputnik defines several categories of tests, each with various depths of subcategories (e.g., the "Expressions" category looks like this:

11_Expressions/
├── 11.3_PostfixExpressions
│   ├── 11.3.1_Postfix_Increment_Operator
│   │   ├── S11.3.1_A1.1_T1.js (a single test)
│   │   ├── S11.3.1_A1.1_T2.js
│   │   ├── ...

Overall, there are 111 leaf categories (categories which do not contain other categories). We considered the number of leaf categories in which we had passed at least one test. Of the 111 categories, we had coverage in 73 of the categories, or 65.8%. This indicates that we covered a sizable portion of the language's features. This metric represents the breadth of JavaScript that out interpreter can handle.

Sputnik provides a total of 2427 distinct tests. Js.rs passes 18.2% of those tests.

You can’t perform that action at this time.