The Thrust Compiler is a compiler that transfers the source code of Thrust files directly to the specified destination. The process includes static type analysis, code generation, destination-specific optimizations, machine-specific code compilation, and finally, emitting or linking.
Important
The compiler is in an early development phase. It still hasn't made the major releases.
Among the dependencies required by the compiler is LLVM infrastructure.
Automatically:
$ git clone --depth=1 https://github.com/thrustlang/compiler-dependency-builder
$ cd compiler-dependency-builder
$ cargo build --release
$ ./target/release/compiler-dependency-builderAnother way:
$ git clone --depth=1 https://github.com/thrustlang/compiler-dependency-builder
$ cd compiler-dependency-builder
$ cargo run If you want to know a high-level command line view, you should check out: Compiler Dependency Builder - Commands & Flags
You must first clone the repository and access it locally.
$ git clone --depth=1 https://github.com/thrustlang/thrustc
$ cd thrustcAmong other obligatory dependencies we need also other libraries.
You must install each Cargo dependency automatically:
sh scripts/cargo-dependencies.shfish scripts/cargo-dependencies.fishscripts\cargo-dependencies.bat.\scripts\cargo-dependencies.ps1Now you need to have Rust installed with a recent version.
- >= Rust (v1.18.5)
- Rust 2024 Edition
Now you need to compile the compiler with Rust.
$ cargo build --release
$ ./target/release/thrustc --helpAnother way:
$ cargo run -- --helpThrust Compiler offers powerful cross-compilation support, just like Clang.
./thrustc main.thrust my_library.thrust \
-target-triple riscv64-unknown-linux-gnu \
-cpu sifive-u74 \
-opt O3 ./thrustc main.thrust my_library.thrust \
-target-triple wasm32-unknown-unknown \
-opt O3 You can target macOS, Windows, Linux, and other platforms directly from your current system without needing to switch machines.
If you want to know a high-level command line view, you should check out: Thrust Compiler - Commands & Flags
If you want to know a little about the compiler's structure, you should check out: Thrust Programming Language - Compiler Structure
Regarding the concept of bootstrapping in compilers (For more information: https://www.bootstrappable.org/).
The decision was made to fully implement all the programming language functions in the compiler written in Rust, because it proposes a development approach similar to what Gleam Team did for Gleam Programming Language, and also to lighten the workload, given that we are already using LLVM.

