Skip to content

tyrchen/rjs

Repository files navigation

rjs

A lightweight, embeddable JavaScript engine written in Rust, inspired by QuickJS-ng. rjs targets ES2024+ with a focus on correctness, memory safety (zero unsafe in production code paths), small binary size, and competitive interpreter performance — with no JIT, so it runs anywhere QuickJS does (including iOS and WebAssembly).

Highlights

  • ES2024+ language: classes, private fields, generators, async/await, modules, destructuring, tagged templates, optional chaining, BigInt, Symbol
  • Full RegExp: Unicode property escapes, named groups, lookbehind
  • Safe by construction: NaN-boxed values, shape-based objects, reference counting with a cycle collector — all without unsafe in hot paths
  • Small and embeddable: workspace of focused crates (core, parser, vm, builtins, regexp, unicode) with a tiny CLI on top
  • Conformance-driven: a bundled Test262 runner tracks parity with upstream — current baseline ~83.8% of the curated suite

Quick start

Requires a stable Rust toolchain (edition 2024, pinned in rust-toolchain.toml).

git clone https://github.com/tyrchen/rjs
cd rjs
git submodule update --init --recursive
make build

Run a script:

make run ARGS=path/to/script.js

Or launch the REPL:

make repl

Documentation

Workspace layout

apps/
  rjs/              CLI entry point (file runner + REPL)
  test262-runner/   Test262 conformance driver
crates/
  core/             Values, objects, GC, runtime, context
  parser/           Lexer + single-pass parser → bytecode
  vm/               Bytecode interpreter
  builtins/         Built-in objects
  regexp/           RegExp compiler + backtracking NFA
  unicode/          Unicode tables and algorithms

Common tasks

Command What it does
make build Build the workspace
make test Run the full test suite via cargo nextest
make check fmt + lint + test (pre-commit gate)
make run ARGS=foo.js Execute a JavaScript file
make repl Start the interactive REPL
make test262-runner Run the Test262 conformance driver

See the developer guide for the full list.

License

Distributed under the terms of MIT.

See LICENSE for details.

Copyright 2025 Tyr Chen

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages