mach

A programming language for people who want to know what their code is doing.

Statically typed. Explicitly designed. No magic.

main.mach
use          std.runtime;
use print:   std.print;
use alloc:   std.allocator;

rec Point {
    x: f64;
    y: f64;
}

fun (this: &Point) magnitude() f64 {
    ret sqrt(this.x * this.x + this.y * this.y);
}

$main.symbol = "main";
fun main(argc: i64, argv: &&u8) i64 {
    var a: alloc.Allocator = alloc.default();
    fin { alloc.allocator_dnit(?a); }

    val p: Point = Point{x: 3.0, y: 4.0};
    print.printf("magnitude: %f\n", p.magnitude());
    ret 0;
}

Philosophy

Mach is built on the belief that clarity is more valuable than cleverness, and that long-term maintainability outweighs short-term convenience.

What Mach Is

  • Simple — easy to learn, read, and maintain
  • Explicit — WYSIWYG, always. No hidden behavior, no implicit conversions
  • Opinionated — one way to do things. The right way is the only way

What Mach Is Not

  • Batteries-included — the standard library provides building blocks, not frameworks
  • Flexible — if there are two ways to do something, one of them is wrong
  • Hand-holding — safety is a partnership between the language and the programmer

Features

Zero-Dependency Toolchain

The compiler, build system, test runner, and dependency manager are a single binary with no external dependencies. No LLVM. No libc. Just mach.

Manual Memory Management

No garbage collector. Allocator types give you structured control over memory with arena and heap strategies. Scope-based cleanup via fin prevents leaks without runtime overhead.

Pointer Safety at the Type Level

Mutable (*T) and read-only (&T) pointers are distinct types. Functions declare exactly what kind of access they need, and the compiler enforces it.

Compile-Time Introspection

Query type sizes, alignments, and field offsets at compile time. Conditional compilation lets you write platform-specific code that is fully excluded from the binary when not targeted.

Monomorphized Generics

Generic types and functions are fully specialized at compile time. Zero runtime cost, no vtables, no type erasure. You get the code you wrote, and nothing else.

Integrated Tooling

Build, test, and manage dependencies from a single command. The toolchain handles project scaffolding, dependency resolution, and test discovery out of the box.

Platforms

Mach's backend is designed to be modular and target-independent. New platforms are added without modifying the core compiler.

Available

Linux

x86_64

Planned

macOS

x86_64 / ARM64

Planned

Windows

x86_64

Get Started

1

Clone and build

# Prerequisites: git, make, clang
git clone https://github.com/octalide/mach
cd mach
make full
2

Create a project

mach init my-app
cd my-app
3

Build and run

mach build .
mach run .