Getting Started
Build Your First M++ Program
Get M++ running on your machine and compile your first program in minutes.
Prerequisites
01
LLVM / Clang 14+
Required to compile LLVM IR to native binaries. Download from llvm.org
02
Windows (x86_64)
Currently the only supported platform. Linux support is planned.
03
mpp.exe
A pre-built bootstrap compiler binary is included in the repository — no build step required to get started.
1
Get M++
git clone https://github.com/mathiassol/mpp cd mpp
2
Write Your First Program
Create a file called hello.mpp:
fn main() {
let message = "Hello, R2ND!";
print(message);
}3
Compile and Run
.\mpp.exe hello.mpp --llvm .\hello.exe
# Output: Hello, R2ND!
4
Explore Examples
The repository includes a full examples directory covering all language features:
hello.mppvariables.mppfunctions.mppstructs.mppenums.mppgenerics.mpptraits.mppclosures.mpperror_handling.mppmodules.mppdefer.mpplowlevel.mppmemory.mpp
.\mpp.exe examples\structs.mpp --llvm .\structs.exe
What Just Happened?
01
Parse— The compiler reads your .mpp source file and builds an AST.
02
Emit LLVM IR— The AST is lowered to LLVM IR (.ll file) — a portable assembly-level language.
03
Compile to native— clang is invoked to compile the .ll file to a native Windows executable.
04
Link runtime— mpp_runtime_llvm.c is automatically linked, providing built-ins like print().
Build the Compiler from Source
M++ is self-hosted — the compiler is written in M++ itself. Once you have mpp.exe, you can rebuild the compiler with:
# Self-hosted: build the compiler with itself .\mpp.exe bootstrap\mpp.mpp --llvm # Run tests powershell -ExecutionPolicy Bypass -File tests\run_bootstrap_tests.ps1
Project Layout
mpp/ ├── mpp.exe # Pre-built bootstrap compiler ├── mpp_runtime_llvm.c # C runtime linked into every binary ├── bootstrap/ │ └── mpp.mpp # Self-hosted compiler source ├── examples/ │ ├── hello.mpp │ ├── variables.mpp │ ├── structs.mpp │ └── ... ├── tests/ │ └── run_bootstrap_tests.ps1 └── README.md