Getting started
Mini is a Kotlin compiler. You write .kt files, minic turns them into C17 and clang links the result with a small C runtime into a native executable.
Just want to use Mini?
Install a prebuilt release with one command (no JDK needed), or try the compiler in your browser in the tutorial. Start with the installation guide if you want to choose between a project and a standalone file. The checkout instructions below are for working on Mini itself.
Requirements
| Needed | Why |
|---|---|
| clang (or gcc) | compiles the generated C |
A release (install.sh) or a checkout of the repository | the tools locate their bundled runtime and standard library from the toolchain installation |
| libuv (optional) | only needed to run the runtime test suite, not to compile programs |
Supported platforms are Linux (x64, arm64) and macOS (Apple silicon). Windows is planned.
Install the project tool and compiler
curl -fsSL https://raw.githubusercontent.com/HenrySchwerdt/mini/main/install.sh | sh
export PATH="$HOME/.mini/bin:$PATH"
mini new hello && cd hello && mini runmini is the native project tool (no JVM, no Gradle), minic the driver for explicit source files; the command line reference lists its commands. In a checkout, ./mini new hello builds the tool and the native compiler on first use without Gradle.
Build the native toolchain from a checkout
git clone https://github.com/HenrySchwerdt/mini
cd mini
./minic build examples/hello.kt -o build/helloThe ./minic and ./mini scripts build the native toolchain (build/native) on first use, and again whenever its sources are newer than the installed binaries, then run it. You can also build it explicitly:
./mini --versionHello, world
fun main() {
val name = "Mini"
println("Hello, $name!")
for (i in 1..3) println("$i * $i = ${i * i}")
}./minic build examples/hello.kt -o build/hello
./build/helloOutput, produced by building and running exactly this file in CI:
Hello, Mini!
1 * 1 = 1
2 * 2 = 4
3 * 3 = 9minic build takes one or more .kt files (exactly one has fun main()), the output path with -o, and a few options. See the command line reference.
./minic check: only the memory checker
./minic check examples/memory_leak.ktcheck runs the front end and the Strict-mode ownership checker and stops there: no C is generated and nothing is linked. It prints diagnostics on stderr and exits with status 1 if there is an error. --brief prints only line:col: CODE lines on stdout. minic build runs the same checker before code generation, so an error stops the build too.
Every file is parsed and type-checked. A file opting in with @file:MemoryMode(Mode.Strict) also has tracked ownership obligations checked; Managed code can still report ordinary syntax and type errors. The memory guide explains what is checked.
Where to go next
- Mini and Kotlin/JVM: what works, what does not, known gaps.
- Learn Mini: the interactive tutorial, every example runs in your browser.
- Language tour: the listings for the Kotlin features Mini supports.
- Memory guide: the part that makes Mini different.
- How it works: the compiler pipeline and the runtime.