Get Started
mu is small enough to learn in an afternoon and complete enough to build with: run the REPL, compile standalone binaries with no toolchain installed, and cross-compile them for another architecture.
Before you install anything
play.mu-lang.dev runs mu in the browser, with every example from the repository already loaded. It is the fastest way to find out whether you like the language — try hello, closures, or exact decimals — and it takes a shareable link, so a question about mu can travel as a program.
The playground refuses programs that open sockets, start processes or call into shared libraries. That is a property of that deployment, not of the language: locally, mu has no such limit.
Requirements
- Go 1.25+ and Git in your PATH.
Quickstart
- Clone the repository:
git clone https://git.mills.io/prologic/mu.git
cd mu
- Build the host:
go build -o ./mu ./cmd/mu
- Run the REPL:
./mu
Type help() at the prompt for the keywords, builtins and stdlib modules
available, and help(name) for anything in particular:
µ> help(len)
Builtin len
len(value) returns the length of a string, list, map, or buffer.
help() answers from the running program, so it can only describe what is
already loaded. To look something up without one, build mu-doc:
go build -o ./mu-doc ./cmd/mu-doc
./mu-doc # every builtin, prelude name and module
./mu-doc sockets # a module
./mu-doc strings.split # one declaration
./mu-doc -k parse # search names and documentation
It is the same documentation as doc.mu-lang.dev, because both are extracted from the library’s source, and it works offline.
- Try a hello program:
fn main() {
print("Hello World!")
}
main()
Next steps
- Take the language tour to learn core syntax.
- Read the runtime guide for the VM and native pipeline.
- Explore the standard library modules, and look them up in the library reference.
- Dive into the specification for the full contract.
CLI essentials
- Run a file:
./mu hello.mu - Emit assembly:
./mu -S -o hello.ir hello.mu - Emit object file:
./mu -c -o hello.mobj hello.mu - Run an object:
./mu hello.mobj - Native build:
./mu -B -o hello hello.mu - Print final result:
./mu -print-result hello.mu - Cross-compile:
./mu -B -p linux/riscv64 -o hello hello.mu
Tooling helpers
- Format:
./mu -fmt hello.mu(use-wto write) - Static checks:
./mu -check hello.mu - Run mu tests:
./mu -test ./lib - List a program’s imports:
./mu -deps hello.mu
Compiling mu with mu
The compiler in selfhost/ is written in mu, and you can use it the same way
you use the Go host:
./mu selfhost/mu.mu hello.mu # run through the mu-written VM
./mu selfhost/mu.mu -B -o hello hello.mu # compile with the mu-written backend
sh scripts/bootstrap.sh # rebuild it with itself, and check the fixpoint
Explore examples
- examples/basics/hello.mu for the canonical entrypoint
- examples/systems/concurrency.mu for tasks and channels
- examples/basics/macros.mu for macros
- examples/systems/ffi-linux.mu for the FFI helper
References
- Repository: git.mills.io/prologic/mu
- Full tutorial: docs/GettingStarted.md
- Language contract: docs/Specification.md
- Compiler/VM details: docs/Implementation.md
Design goals
- Keep the host builtin surface minimal.
- Make the compiler → VM pipeline easy to reason about.
- Move higher-level capabilities into mu itself.