Skip to content
@thrustlang

Thrust Programming Language

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

Thrust Programming Language logo

Thrust Programming Language

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

Compiler | Package Manager | Downloads | Website Source | Roadmap

separator

What specific problem it solves?

Thrust simplifies C APIs in a way that is easier to explain, and it integrates compiler control and common conveniences directly into the language. A growing part of the standard library is implemented in a way that is easy to use with computer knowledge from the start by renaming, wrapping, and reimplementing a big part of the old C APIs in a better way.

Design

Thrust exposes memory operations, data layout, explicit memory alignment, calling conventions, target information and compiler control in the source code while providing high-level zero cost abstractions with simplicity.

Zero cost abstractions are resolved during compilation. Generics are specialized, modules declare imported files and symbols, and compile time conditionals remove inactive code before type checking and code generation. A scope based ownership mechanism can automatically deallocate memory without runtime ownership tracking.

Experimental And Advanced Areas

  • CUDA / NVPTX: GPU kernels compiled to PTX and launched through CUDA tooling.
  • Inline assembly: asmfn, asm, and global_asm for architecture-specific code.
  • WebAssembly: wasm32 code generation and ABI support without an integrated WASI or browser runtime.
  • C header integration: importC is reserved for work on importing C declarations and is not yet a complete integration.
  • Language server: completion and limited source analysis are available, while diagnostics, definitions, and document symbols are still incomplete.

These areas are incomplete or depend on external platform tooling. Their interfaces and supported workflows may change as the compiler matures.

Examples

Standard Library And Generics

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);
    io::print("fib(%d) = %d\n", 10, result);
    
    return 0;
}

Generic Data Structures

struct Buffer[T] @public {
    data: ptr[T],
    length: usize,
    capacity: usize
}

var buffer := new Buffer[u8] {
    data: nullptr,
    length: 0,
    capacity: 64
};

C Interoperability

fn puts(text: const array[char]) s32
    @public
    @extern("puts")
    @convention("C");

Compile-Time Selection

@if(isLinux()) const PLATFORM: u32 = 2;
@elif(isWindows()) const PLATFORM: u32 = 1;
@else const PLATFORM: u32 = 3;

Status

Thrust is evolving in early 0.2.x releases. Its compiler has a complete frontend to LLVM, static type checking, AOT compilation, JIT execution, a versioned standard library, and target configurable code generation.

The language and standard library are still young. Target support varies by ABI, linker, system libraries.

Useful Repositories

Support

Contributors are welcome. Whether you are new to systems programming or experienced with low-level tooling, there is room to help with language design, compiler work, documentation, examples, tests, and editor support.

Social Networks

Discord

separator

Pinned Loading

  1. thrustc thrustc Public

    A general-purpose, statically typed systems programming language

    Rust 35 4

  2. torio torio Public

    A package manager and compiler-controller

    Rust 3 1

Repositories

Showing 10 of 13 repositories

Top languages

Loading…

Most used topics

Loading…