Warning
The development of The Thrush Compiler (thrushc) is incomplete; build the program at your own risk, as it may contain errors.
The Thrush Compiler efficiently transfers source code from Thrush files directly to the intended target. Beyond this, it serves as a flexible bridge, integrating with diverse code generators for both research and development purposes.
Warning
While the compiler itself can theoretically generate code for these architectures, successful compilation into executable files (like .o files or final binaries) ultimately depends on your host system having the necessary toolchain components (e.g., assemblers, linkers, system libraries) for that specific target. The assembler should, however, produce output without issues.
Beyond the standard triple targets, the compiler also supports all architectures available through the LLVM-C API. These include:
x86_64
AArch64
RISC-V
ARM
MIPS
PowerPC
SystemZ
AMDGPU
Hexagon
Lanai
LoongArch
MSP430
NVPTX
SPARC
XCore
BPF
SPIR-V
WebAssembly
You can see the syntax of the language properly in the repository: https://github.com/thrushlang/syntax
Currently, the only backend available for the thrush compiler to compile is the current LLVM, using the LLVM-C API.
The compiler has Clang compiled for Linux & Windows inside the executable in case the programmer does not have access to it; however, you can specify a custom Clang & GCC.
The code generation is in 3 phases.
- Intermediate Code Generation (
LLVM IR
). - Emit object files (
.o
). - Linking with some linker through the
Clang
orGCC
C compilers. ~ Rust 2015 be like
In summary:
You must first clone the repository and access it locally.
git clone --depth 1 https://github.com/thrushlang/thrushc && cd thrushc
Among the dependencies required by the compiler is the LLVM-C API, which you can find pre-compiled for each operating system at Thrush Programming Language Toolchains.
Automatically:
cd builder
cargo run
Now 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 run -- --help