Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mimas

mimas is a statically typed, embeddable scripting language for Rust. It carries over much of Rust's syntax and ergonomics, reshaping the rest to deliver what a scripting layer is good for: fast iteration, logic you can change without a rebuild, and a runtime that ships anywhere your program runs.

github version built with Rust license ci

Typed

Static typing with inference, user-defined types, exhaustive pattern matching, and more of the same features that empower you in Rust.

let area: float? = match my_shape {
    Shape::Circle(r) => r * r * std::math::PI,
    Shape::Rectangle(w, h) => w * h,
    _ => null,
};

Flexible

Rigorous, not rigid. Strong inference lets you focus on your goals, not your types. Writing is intuitive, and sub-second compile times keep you in motion.

let nums = [5, 3, 8, 1];
let big = for n in nums { if n > 4 collect n; };
print(f"found {big.len()}: {big}"); // -> found 2: [5, 8]

Fast

Stay fast. Static analysis fuels the VM, putting mimas at the front of the pure-Rust scripting runtimes. See the benchmarks for more.

physics struct field access, float math

mimas1.01s
fabricator3.13s
rune3.33s
boa5.00s
koto8.12s
dyon8.98s
steel9.83s
rhai13.83s
rustpython15.34s

Pure-Rust runtimes, measured on an AMD Ryzen 7 9800X3D running Linux. mimas v0.3.0 · Rhai (perf) v1.26.0 · Rune v0.14.2 · Koto v0.16.1 · Dyon v0.51.2 · Steel v0.8.3 · Boa v0.22.0 · RustPython v0.5.0 · Fabricator git cef73ca

Extendable

Share your Rust types and functions with the mimas macro, all while maintaining type safety. The macro alone is all you need for mimas to find it.

// rust
#[mimas]
struct User(String);

#[mimas]
impl User {
    fn greet(self) {
        println!("Hello, {}!", self.0);
    }
}
// mimas
let user = User("mimas");
user.greet(); // Hello, mimas!

Robust

  • Guaranteed “Results” – mimas treats any panic as a bug, both in the compiler and the VM.
  • Tested top to bottom – over 1,900 tests cover every corner of the codebase. Even the tests are tested, thanks to cargo mutants.
  • Helpful diagnostics – bugs are caught at their source with clear reports powered by miette:
  error:  non-exhaustive match
   ╭─[tools/src/main.mim:3:1]
 2 │     
 3 │ ╭─▶ match Color::random() {
 4 │ │       Color::Red => print("Red!"),
 5 │ │       Color::Blue => print("Blue!"),
 6 │ ├─▶ }
   · ╰──── missing pattern `Color::Green`
 7 │     
   ╰────
  ╰─▶   advice:  `Color::Green` defined here
         ╭─[tools/src/color.mim:6:5]
       5 │     Blue,
       6 │     Green,
         ·     ──┬──
         ·       ╰── this variant has no matching arm
       7 │ }
         ╰────