mu language

Minimal by design. Built for clarity.

mu (µ) is a focused programming language with a stack-based VM, a toolchain-free native backend, and a compiler that reaches a byte-identical self-hosting fixpoint. Thirteen keywords, 28 host builtins, and a standard library that stays out of the way.

hello, mu

fn main() {
  print("Hello World!")
}

main()

Readable entrypoints, no ceremony, and a REPL-first workflow. — run this one

Try it, then look it up

Two companion sites, both generated from this repository — so what they show is what the language actually does today, not what a page once said it did.

Start anywhere: exact decimals, lazy iterators, tasks and channels, or errors as values.

Why mu

mu is for builders who want a compact language, a transparent compiler pipeline, and a runtime they can reason about.

Intentional syntax

Thirteen keywords, one loop, explicit control flow, and no hidden magic.

Stack-based VM

Bytecode simple enough to inspect, profile — and reimplement, which mu has already done to itself.

Composable stdlib

Keep the host minimal and move capability into mu-written libraries.

Exact decimals

0.1 + 0.2 is 0.3. 3.14 is a literal, and your own types can define the operators too.

REPL-first

Iterate fast, explore ideas, and turn them into modules.

A clear pipeline

The stage-0 host keeps the compiler, assembler, and VM transparent. Every instruction is part of an evolving contract between the spec, the VM, and the native backend.

Lexer → Parser Readable tokens, predictable ASTs.
Compiler → VM Bytecode that stays understandable.
Compiler → Native The same IR lowered to real binaries.
Self-hosted mu compiles itself to a byte-identical fixpoint.

What you can do today

  • Build standalone binaries with no toolchain, and cross-compile them.
  • Open native desktop windows on macOS and Linux — the GUI toolkit is written in mu.
  • Run examples, inspect bytecode, and experiment in the REPL.
  • Extend the stdlib in mu itself — most of it already is.
  • Rebuild the compiler with itself and check the fixpoint.

Start with the guide

Two engines, one language

mu ships with a bytecode VM for fast iteration and a native backend for deployment. The VM is the reference implementation; native compilation follows the same semantics. Both exist twice over — once in Go, once in mu — and all four are held to the same tests.

Bytecode VM

Fast startup, introspectable bytecode, and a REPL-first workflow.

Native compilation

A toolchain-free backend that lowers the same IR to real binaries.

Code as a value

quote makes µ source an ordinary value, so macros are just functions the compiler calls.

FFI + syscalls

Raw syscalls everywhere; C libraries through explicit, inspectable signatures. See the FFI page for where each is supported.

Read the language tour, dive into the runtime, or study the spec. See the docs index for everything else.

Build and run mu

The stage-0 host is a single Go binary. Build once, then run scripts, explore the REPL, or emit bytecode/native artifacts.

Build the host

go build -o ./mu ./cmd/mu

Run a script

./mu examples/basics/hello.mu

Emit bytecode

./mu -S -o hello.ir hello.mu

Native build

./mu -B -o hello hello.mu