/JakeScript

JavaScript lexer/parser/interpreter in Rust 🦀

Primary LanguageRustMIT LicenseMIT

JakeScript

CI License

A work-in-progress JavaScript lexer, parser, and interpreter. Written in Rust 🦀 for fun and learning.

Usage

cargo build --release --workspace

./target/release/jakescript-cli  --eval                      <source-path>  # Evaluate a file
./target/release/jakescript-cli  --lex                       <source-path>  # Lex (tokenise) a file
./target/release/jakescript-cli  --parse  [--json | --yaml]  <source-path>  # Parse a file and output as JSON or YAML
./target/release/jakescript-cli  --repl                                     # Enter an interactive REPL

Crates

  • 🕮 jakescript The core of the project. Contains code for the lexer, parser, interpreter, and most of the tests.
  • â–· jakescript-cli Command line interface with a REPL. Can also run the lexer, parser, and interpreter on a file.

Tests

Run all tests:

cargo test --workspace

Run the main integration test on its own, which evaluates each JavaScript file in the tests-js directory:

cargo test --package jakescript --test js_tests -- --nocapture