This compiler is written in MiniLang and compiles .ml programs to native
Windows x64 (PE32+) and Linux x64 (ELF64) executables. It can rebuild
itself. The Python reference compiler
provides the bootstrap implementation and a second code-generation path.
Download the latest native compiler packages or read the binary installation guide. Version 1.3.2 includes Windows and Linux packages with SHA-256 sidecars; see the release notes and changelog.
Extract the whole Windows ZIP or Linux tar archive. The package includes
std/, an example and the compiler executable. From its directory, on Windows:
.\mlc.exe examples/hello.ml hello.exe --target windows-x64 -I .
.\hello.exeOn Linux:
./mlc examples/hello.ml hello --target linux-x64 -I .
./helloThe output target defaults to Windows x64 on either host. Set
--target linux-x64 for Linux programs. The generated executable runs on
its selected target OS. See README-BINARY.md for package
contents, verification, platform requirements and native media deployment.
A fresh checkout needs a bootstrap compiler. Put MiniLangCompilerPy beside this repository or pass an existing native compiler to the build script. The scripts stage and smoke-test the output before installing it.
Windows PowerShell:
.\build.ps1
.\build\mlc_win64.exe --version
.\build\mlc_win64.exe hello.ml hello.exe -I .Linux shell:
./build.sh
./build/mlc_linux_x64 --version
./build/mlc_linux_x64 hello.ml hello --target linux-x64 -I .Create hello.ml with print "Hello from MiniLang!" before compiling the
last command. build.ps1 -Compiler PATH and ./build.sh --compiler PATH
select a bootstrap compiler explicitly. The Windows script uses a local native
compiler if available and otherwise the sibling Python compiler. The Linux
script follows the same pattern for build/mlc_linux_x64 and the sibling
Python compiler. Run -NoReplace on Windows or --no-replace on Linux to
keep an existing compiler untouched while inspecting the new build.
- Classes with single inheritance, virtual dispatch,
override,super, constructors, visibility, abstract/final members and inherited interfaces. See the OOP guide. - Functions, closures, optional checked types, structs, enums, arrays, bytes, packages, imports and conditional compilation.
- Native threads, tasks and synchronization with a shared garbage-collected heap on Windows and Linux.
- Standard-library modules, native FFI, typed inline x64 assembly, and
error/trypropagation. - Monolithic compilation and a memory-bounded
.mloobject/link pipeline. The compiler chooses a path for the import graph;--object-pipelineor--no-object-pipelineforces one for verification or measurement.
The language reference covers syntax and runtime
behavior. Generated compiler API and
std API documentation are checked in.
.\build\mlc_win64.exe src/main.ml build/app.exe -I . -I src
.\build\mlc_win64.exe --project minilang.toml
.\build\mlc_win64.exe --helpThe same conservative TOML manifest works with both compilers:
[project]
entry = "src/main.ml"
output = "build/app.exe"
include = ["src", "vendor"]
target = "windows-x64"
incremental = true
cache_dir = ".minilang-cache"Paths are relative to the manifest. The native compiler accepts a shared TOML
subset; see the incremental-build guide for
manifest syntax, cache validation and reuse limits. Direct builds can use
--incremental-cache DIR. Use --no-incremental to bypass caches for one build.
| Option | Use |
|---|---|
--target windows-x64|linux-x64 |
Select the output platform. |
-I DIR |
Add an import root; repeat as needed. |
-DNAME[=VALUE] |
Set a typed conditional-compilation option. |
--subsystem windows |
Build a Windows GUI application. |
--object-pipeline |
Force .mlo object generation and linking. |
--asm, --asm-data |
Emit an assembly listing and optional data sections. |
--heap-reserve SIZE, --gc-limit SIZE |
Configure the native runtime. |
--profile-calls, --pgo-profile FILE |
Collect call counts and guide inlining. |
--profile-compiler |
Report compiler phase timings. |
For the same supported inputs, options and target, the Python compiler,
self-hosted monolithic compiler and self-hosted .mlo pipeline are expected
to emit identical target bytes. Version 1.3.2 restored this for the OOP
regression programs on both targets. See the parity guide,
OOP regression and
release verification matrix.
| Topic | Document |
|---|---|
| Classes and interfaces | OOP guide |
| Language syntax, standard library and FFI | Language reference |
| Binary packages and checksums | Binary installation |
| Incremental builds | Guide |
| Typed inline assembly | Guide |
| Native crypto, checksums and CPU features | Native primitives |
| Compression and platform services | Platform services |
| Executable packing | Packing guide |
| Generated APIs | Compiler · Standard library |
| Changes and releases | Changelog · Releases |
After building the compiler, run the native regression suite on Windows:
.\scripts\run_tests.ps1Both compiler implementations and their documentation were developed with the assistance of generative AI. Licensed under Apache 2.0; see third-party notices for bundled or generated-code components that require attribution.