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, making it the fastest pure-Rust scripting language – competitive even with C++ runtimes like Luau. See the benchmarks.

physics scalar float throughput, tight loops

mimas1.05s
luau1.16s
fabricator2.97s
rune3.48s
koto7.89s
dyon8.68s
boa10.01s
steel12.30s
rhai14.46s
rustpython16.71s

mimas v0.1.0 · Luau (mlua) v0.11.4 · Rhai (perf) v1.25.1 · Rune v0.14.2 · Koto v0.16.1 · Dyon v0.51.0 · Steel v0.8.2 · Boa v0.21.1 · RustPython v0.5.0 · Fabricator git 60c32e1

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);
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,500 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]
 23 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 │ }
         ╰────