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.

mimas repl

Runs with the mimas standard library with certain elements removed (i.e.: std::fs)

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

mimas836ms
luau1.18s
fabricator3.12s
rune3.51s
dyon8.82s
steel9.84s
rhai14.32s

Measured on a 2021 M1 Max MacBook Pro. mimas v0.4.0 · Luau (mlua) v0.11.4 · Rhai (perf) v1.26.0 · Rune v0.14.2 · Dyon v0.51.2 · Steel v0.8.3 · 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 2,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]
 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 │ }
         ╰────