Thrust official banner

Thrust Programming Language

A general-purpose, statically typed systems programming language for writing verbose, accurate, and fast code.

Philosophy

Thrust gives low-level machine control like C, while still letting you reach for higher-level abstractions when needed. New features are designed to keep the same mental model: if you can reason about C, you can reason about Thrust.

Quickstart

./thrustc fibonacci.thrust -cc-args="-o fibonacci" && ./fibonacci
import std::io;

fn fibonacci [T] (n: T) T @public {
    if n <= 0 { return 0; }
    if n == 1 { return 1; }

    var a: T = 0;
    var b: T = 1;
    var i: T = 2;
    var result: T = 0;

    while i <= n {
        result = a + b;
        a = b;
        b = result;
        i++;
    }

    return result;
}

fn main() s32 @public {
    var result: s32 = fibonacci[s32](10);
    // Expected result: fib(10) = 55
    io::print("fib(%d) = %d\n", 10, result);
    return 0;
}

C-Style Clarity

A familiar C-style mental model with explicit, predictable behavior for systems programming.

No Runtime Overhead

Generic functions and structures with explicit instantiation and no runtime generic overhead.

C Interoperability

Direct interop with C code via @extern and @convention("C").

Compile-Time Conditionals

Use @if, @elif, and @else to select platform-specific code at compile time.

Cross-Platform Targets

Build for Linux, Windows, macOS, RISC-V, WebAssembly and more from one machine.

Built-in Compile Helpers

Type/layout builtins like sizeOf, alignOf, and isSameType for safer code.