/artichoke

💎 Artichoke is a Ruby made with Rust

Primary LanguageRustMIT LicenseMIT

Artichoke Ruby

CircleCI Discord
Core documentation Virtual filesystem documentation mruby backend documentation mruby-sys documentation

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.

Architecture

A Ruby implementation based on Artichoke consists of three components: Artichoke core, a VM backend, and the Artichoke frontend.

Core

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.

Runtime

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.

Embedding

Artichoke core will support embedding with:

Experimentation

A Rust-implemented Ruby runtime offers an opportunity to experiment with:

VM Backend

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.

Experimentation

VM backends offer an opportunity to experiment with:

Frontend

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:

Try Artichoke

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

Contributing

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.

Discussion

If you'd like to engage in a discussion outside of GitHub, you can join Artichoke's public Discord server.