Ruby 4.0, written in Rust.
Metorex runs Ruby 4.0 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
total = [Point.new(1, 2), Point.new(3, 4)].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
Output
#<struct Point x=4, y=6>
y leads by 2
Ruby 4.0 syntax
Metorex reads Ruby 4.0 source with its own lexer and parser. RUBY_VERSION reports 4.0.6.
Code as objects
A method's body is available at runtime as syntax tree nodes you can inspect.
Built-in test runner
metorex --test DIR finds and runs *_test.rb, test_*.rb, and *_spec.rb files.
C extensions
Loads C extensions written against Ruby's C API.
REPL
metorex --repl starts an interactive session.
Written in Rust
The lexer, parser, and bytecode VM are written in Rust.
Metorex is in early development. Programs that run under MRI may not run under Metorex yet. Open an issue for one that fails, or send a pull request.