Skip to content

The Thrush Programming language. A system's programming language that provides complete low-level control.

License

Notifications You must be signed in to change notification settings

thrushlang/thrushc

Repository files navigation

logo

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

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.

Target Architectures

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.

LLVM

LLVM Targets

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

Syntax

You can see the syntax of the language properly in the repository: https://github.com/thrushlang/syntax

¿How it works?

Currently, the only backend available for the thrush compiler to compile is the current LLVM, using the LLVM-C API.

Embedded Clang

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.

Code Generations Phases

The code generation is in 3 phases.

  • Intermediate Code Generation (LLVM IR).
  • Emit object files (.o).
  • Linking with some linker through the Clang or GCC C compilers. ~ Rust 2015 be like

In summary:

Getting Started

Start

You must first clone the repository and access it locally.

git clone --depth 1 https://github.com/thrushlang/thrushc && cd thrushc

Build dependencies

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

Build the Compiler

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

About

The Thrush Programming language. A system's programming language that provides complete low-level control.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages