Artichoke is a platform for implementing spec-compliant Ruby implementations. Artichoke provides a Ruby runtime implemented in Rust that can be loaded into many VM backends.
A Ruby implementation based on Artichoke consists of three components: Artichoke core, a VM backend, and the Artichoke frontend.
Artichoke core exposes a set of traits that define:
- Capabilities of a VM backend.
- Capabilities of a
Ruby
Value
. - Interoperability between the VM backend and the Rust-implemented core.
Capabilities a Ruby implementation must provide include evaling code, declaring classes and modules, and exposing top self.
Artichoke core provides an implementation-agnostic Ruby runtime which any
implementation can load. The runtime in Artichoke core will pass 100% of the
Core and
Standard Library
Ruby specs. The runtime will be implemented in a hybrid of Rust and Ruby. The
Regexp
implementation is a
representative example of the approach.
Artichoke core will support embedding with:
- Multiple filesystem backends, including an in-memory virtual filesystem.
- Optional standard-library.
- Optional multi-threading.
- Capturable IO.
A Rust-implemented Ruby runtime offers an opportunity to experiment with:
- Improving performance of MRI Core and Standard Library.
- Implementing the runtime with state-of-the-art dependencies.
- Distributing single-binary builds.
Artichoke core does not provide a parser or a VM for executing Ruby. VM backends provide these functions.
Artichoke currently includes an mruby backend. There are plans to add an MRI backend and a pure Rust backend.
VM backends are responsible for passing 100% of the Language Ruby specs.
VM backends offer an opportunity to experiment with:
Artichoke will include ruby
and irb
binary frontends
with dynamically selectable VM backends.
Artichoke will produce a WebAssembly frontend.
Artichoke will include implementation-agnostic C APIs targeting:
You can try Artichoke in your browser. The Artichoke Playground runs a WebAssembly build of Artichoke.
If you would prefer to run a local build, set up a Rust toolchain and launch an interactive Artichoke shell with:
cargo run -p artichoke-frontend --bin airb
Artichoke aspires to be a Ruby 2.6.3-compatible implementation of the Ruby programming language. There is lots to do.
If Artichoke does not run Ruby source code in the same way that MRI does, it is a bug and we would appreciate if you filed an issue so we can fix it.
If you would like to contribute code 👩💻👨💻, find an issue that looks interesting and leave a comment that you're beginning to investigate. If there is no issue, please file one before beginning to work on a PR.
If you'd like to engage in a discussion outside of GitHub, you can join Artichoke's public Discord server.