Brimstone: A High-Compliance JavaScript Engine Built in Rust
Brimstone is a JavaScript engine meticulously crafted in Rust, boasting over 97% ECMAScript compliance, featuring a custom VM, GC, and parser. Currently a work in progress, it aims for full JavaScript language support.
Brimstone is a JavaScript engine entirely written from scratch in Rust, with the ambitious goal of achieving full support for the JavaScript language.
While Brimstone is still under active development, it already demonstrates remarkable progress, supporting almost all of the JavaScript language. It currently passes over 97% of the ECMAScript language tests in test262. However, it is not yet ready for production use.
This engine meticulously implements the ECMAScript specification. Its design draws significant inspiration from the architectures of V8 and SerenityOS's LibJS. Brimstone's approach is to implement nearly all engine components from scratch, minimizing external dependencies. A notable exception to this is its use of ICU4X for internationalization support.
Brimstone Features:
- Bytecode VM: Heavily inspired by the design principles of V8's Ignition.
- Compacting Garbage Collector: Written in
veryunsafe Rust for optimized performance. - Custom RegExp Engine: A bespoke implementation for regular expression processing.
- Custom Parser: Developed specifically for Brimstone.
- Extensive Built-in Objects and Functions: Almost all standard built-in objects and functions are implemented according to the ECMAScript specification.
Building and Testing
Brimstone leverages standard cargo commands for building and execution.
To build the bs executable:
cargo build
To run from source:
cargo run
JavaScript files can be executed directly using the bs command:
# Build brimstone
cargo build
# Execute a JavaScript file, for example, './hello.js'
./target/debug/bs ./hello.js
If hello.js contains console.log("Hello world!");, the output would be:
Hello world!
Testing
Brimstone's development relies heavily on a comprehensive suite of first and third-party integration tests. Most notably, it utilizes the official test262 test suite. A custom integration test runner is included and can be executed with:
cargo brimstone-test
Unit and snapshot tests are available and can be run using:
cargo test
For robustness, fuzz testing can be initiated via:
./tests/fuzz/run.sh
For more detailed information regarding the testing framework, please refer to the testing README.
Missing Features
As of the February 2025 TC39 meeting, Brimstone has implemented all features up to ES2024, as well as all Stage 4 proposals, with the exception of the following features:
SharedArrayBufferAtomics