Skip to content

thrustlang/thrustc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

813 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

The Thrust Compiler

standard-separator

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.

Getting Started

Build dependencies

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-builder

Another 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 thrustc

Build Cargo dependencies

Among other obligatory dependencies we need also other libraries.

You must install each Cargo dependency automatically:

Bash

sh scripts/cargo-dependencies.sh

Fish

fish scripts/cargo-dependencies.fish

CMD

scripts\cargo-dependencies.bat

PowerShell

.\scripts\cargo-dependencies.ps1

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 build --release
$ ./target/release/thrustc --help

Another way:

$ cargo run -- --help

Cross Compilation

Thrust Compiler offers powerful cross-compilation support, just like Clang.

RISC-V 64-bit

./thrustc main.thrust my_library.thrust \
  -target-triple riscv64-unknown-linux-gnu \
  -cpu sifive-u74 \
  -opt O3 

WebAssembly

./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.

Commands & Flags

If you want to know a high-level command line view, you should check out: Thrust Compiler - Commands & Flags

Compiler Structure

If you want to know a little about the compiler's structure, you should check out: Thrust Programming Language - Compiler Structure

Q&A

> Why isn't the compiler designed to use it as a bootstrap compiler?

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.

> When will this be released as a stable?

THEreason.mp4

About

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

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors