mimas
A flexible, statically typed scripting language for Rust.
Get started · Tour the language · Why mimas? · Benchmarks · Reference
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, quick compile times, and runtime flexibility -- without trading away the safety that keeps you out of the debugger.
let shapes = ;
let total = 0.0;
for s in shapes
print;
What you get
| 🪶 Flexible | Inference writes your types, compiles stay fast, and errors point toward the fix instead of just turning you away. Garbage collected -- no borrow checker, no lifetimes. |
| 🛡️ Typed | Static typing with inference, user-defined types, exhaustive pattern matching, and T? option safety so an unexpected null can't reach you. |
| 🧩 Extendable | Share Rust types and functions with the #[mimas] macro -- they're type-checked just like native ones. |
| ✅ Robust | Every panic is treated as a bug, top to bottom. Over 2,500 tests (the tests are tested, via cargo mutants), with clear diagnostics powered by miette. |
Read the full tour for a quick pass over the whole language.
Quick start
At the command line -- mirroring cargo, with check, build, and run:
Embedded in a Rust project -- add mimas and compile a script in two lines:
const SOURCE: &str = include_str!;
let mut vm = compile_source.unwrap;
let _ = vm.run;
Sharing your own Rust types is one attribute away:
;
let user = User("mimas");
user.greet(); // -> Hello, mimas!
The full embedding guide lives at Extension with Rust.
Performance
mimas compiles .mim source to bytecode for a register-based VM with a lifetime-safe (gc-arena) heap. It outpaces the other pure Rust languages in most tests and is within shooting range of Luau, a mature C++ runtime. See the full benchmarks for the methodology and numbers.
The compiler is quick too: the whole pipeline (parse, type-check, lower, emit bytecode) runs at roughly 500,000 lines per second, so for scripts there's effectively no compile step you'd notice.
Examples
Runnable projects live in examples/:
extension-- sharing Rust structs, enums, methods, and fallible functions with a script via#[mimas].game-loop-- driving a script from a host game loop, using fixtures andFreezeCellto safely hand mimas a&mutto host state.bevy— a breakout game on thebevyfeature, which runs.mimscripts as hot-reloaded Bevy assets with typed access to reflected components, resources, and messages. See the Bevy guide, and run it withcargo run --manifest-path examples/bevy/Cargo.toml.
Editor support
A language server, mimas-lsp, gives any LSP-capable editor diagnostics, hover, go to definition, references, rename, outlines, and inlay hints. Running a Rust host through cargo writes its API to target/mimas/<binary>.json, which the server loads for the scripts in that host's cargo package so the host's types and functions are checked too. See the Language Server page for setup and limitations.
A VS Code extension lives in tools/vscode. You can install it from the marketplace.
Status
mimas is early in development. It compiles, type-checks, and runs end-to-end, but nothing is promised to be stable yet. Expect sharp edges, expect things to move, and feel most welcome to contribute.
How it's built
A single pipeline turns source into a running program, split across a handful of crates in crates/:
.mim -> parse -> solve (type check) -> compile (lower + bytecode) -> vm (register VM)
shared carries the common vocabulary, api and macros back the #[mimas] embedding surface, library is the standard library, and cli is the mimas binary.
License
Dual licensed under your choice of MIT or Apache 2.0.