A general-purpose, statically typed systems programming language for writing verbose, accurate, and fast code.
Compiler | Package Manager | Downloads | Website Source | Roadmap
Thrust exposes memory operations, data layout, explicit memory alignment, calling conventions, and target information 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.
Thrust keeps memory management direct and simple. The programmer controls allocation, pointer validity, resource lifetime, and the exact point at which memory is released, as in C.
- CUDA / NVPTX: GPU kernels compiled to PTX and launched through CUDA tooling.
- Inline assembly:
asmfn,asm, andglobal_asmfor architecture-specific code. - WebAssembly:
wasm32code generation and ABI support without an integrated WASI or browser runtime. - C header integration:
importCis 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.
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;
}
struct Buffer[T] @public {
data: ptr[T],
length: usize,
capacity: usize
}
var buffer := new Buffer[u8] {
data: nullptr,
length: 0,
capacity: 64
};
fn puts(text: const array[char]) s32
@public
@extern("puts")
@convention("C");
@if(isLinux()) const PLATFORM: u32 = 2;
@elif(isWindows()) const PLATFORM: u32 = 1;
@else const PLATFORM: u32 = 3;
Prebuilt compiler binaries are available in the thrustc releases for Linux x64, Windows x64, and macOS x64/ARM64.
./thrustc fibonacci.thrust -cc-args="-o fibonacci" && ./fibonacci.\thrustc.exe fibonacci.thrust -cc-args="-o fibonacci.exe" && .\fibonacci.exeFor compiler flags and examples, see the thrustc repository.
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.
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.
Spanish speakers are especially welcome.
~ "It takes a long time to make a tool that is simple and beautiful." ~ Bjarne Stroustrup (C++ Programming Language creator)

