硫磺:用 Rust 编写的 ES2025 JavaScript 引擎
Brimstone: ES2025 JavaScript engine written in Rust

原始链接: https://github.com/Hans-Halverson/brimstone

硫磺是一个用 Rust 构建的新型 JavaScript 引擎,致力于完全符合 ECMAScript 标准。目前仍在开发中,它通过了 test262 套件中超过 97% 的测试,并支持高达 ES2024 的特性,包括最近的 TC39 提案(不包括 SharedArrayBuffer Atomics)。 硫磺的设计灵感来自 V8 和 SerenityOS 的 LibJS,优先考虑从头开始的实现,并尽量减少依赖项——ICU4X 是一个关键例外。主要特性包括字节码虚拟机、压缩垃圾收集器、自定义 RegExp 引擎以及对内置对象和函数的完整实现。 硫磺使用标准的 `cargo` 命令构建和运行,并通过集成和单元测试(包括官方的 test262 套件)进行全面测试。虽然尚未达到生产就绪状态,但它展示了在 Rust 中创建强大且符合标准的 JavaScript 引擎方面取得了显著进展。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Brimstone: 用 Rust 编写的 ES2025 JavaScript 引擎 (github.com/hans-halverson) 14 分,ivankra 发表于 1 小时前 | 隐藏 | 过去 | 收藏 | 1 条评论 maxloh 6 分钟前 [–] 你能把它和 Boa 比较一下吗?它也是用 Rust 编写的。https://github.com/boa-dev/boa 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Brimstone is a JavaScript engine written from scratch in Rust, aiming to have full support for the JavaScript language.

Brimstone is a work in progress but already supports almost all of the JavaScript language (>97% of the ECMAScript language in test262). Not ready for use in production.

Implements the ECMAScript specification. Heavy inspiration is taken from the design of V8 and SerenityOS's LibJS. Brimstone chooses to implement almost all components of the engine from scratch with minimal dependencies, with the notable exception of ICU4X.

Brimstone features:

  • Bytecode VM, heavily inspired by the design of V8's Ignition
  • Compacting garbage collector, written in very unsafe Rust
  • Custom RegExp engine
  • Custom parser
  • Almost all builtin objects and functions implemented to spec

Standard cargo commands to build and run.

  • cargo build to build the bs executable
  • cargo run to run from source

JavaScript files can be executed with bs:

# Build brimstone
cargo build

# Execute a JavaScript file
./target/debug/bs ./hello.js
Hello world!

Brimstone relies heavily on a set of first and third party integration test suites, most notably the official test262 test suite. A custom integration test runner is included. This can be run with:

Unit and snapshot tests can be run with cargo test.

For more information on testing see the testing README.

All features up to ES2024 have been implemented, as well as all stage 4 proposals as of the Feb. 2025 TC39 meeting, except for the following features:

  • SharedArrayBuffer
  • Atomics
联系我们 contact @ memedata.com