Passes ruby/spec

Ruby 4.x,
written in Rust.

Meta Object Runtime Execution

Metorex runs Ruby 4.x programs, and it exposes a method's syntax tree as objects your program can read at runtime.

example.rb
Point = Struct.new(:x, :y) do
  def +(other) = Point.new(x + other.x, y + other.y)
end

points = [Point.new(1, 2), Point.new(3, 4)]
total = points.sum(Point.new(0, 0))
puts total.inspect

case total
in { x: Integer => x, y: } if y > x
  puts "y leads by #{y - x}"
end
terminal
$ metorex example.rb
#<struct Point x=4, y=6>
y leads by 2

Features

What Metorex Does Today

Ruby 4.x Syntax

Metorex reads Ruby 4.x source with its own lexer and parser. RUBY_VERSION reports the MRI release it follows.

Language Tour →

Code as Objects

A method's body is available at runtime as syntax tree nodes you can inspect.

Read a Method's Tree →

Built-In Test Runner

metorex test finds and runs the *_test.rb, test_*.rb, and *_spec.rb files under test/.

Rex →

C Extensions

Loads C extensions written against Ruby's C API.

C API →

REPL

metorex repl starts an interactive session.

Command Line →

Written in Rust

The lexer, parser, and interpreter are written in Rust.

Architecture →

Metorex passes the ruby/spec suite.

Every spec in core, library, language, command_line, optional, and security runs in CI. If a program behaves differently under Metorex than under MRI, open an issue with the program and both outputs.