Installation
Dryft is a compiled language with a compiler written in Rust. Follow these steps to install and set up your development environment.
Prerequisites
Before installing Dryft, ensure you have the following dependencies:
Install Rust
Dryft’s compiler is written in Rust. Install Rust and Cargo using rustup:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Verify installation:rustc --version
cargo --version
Install a Backend Toolchain
Dryft supports multiple compilation backends. Choose one:GCC Backend (Recommended)
The GCC backend compiles Dryft to C99, then uses GCC to create executables.Ubuntu/Debian:sudo apt-get update
sudo apt-get install build-essential gcc
Fedora/RHEL:macOS:x86-64 Assembly Backend (Optional)
For direct assembly output, install NASM:Ubuntu/Debian:sudo apt-get install nasm
Fedora/RHEL:macOS: Clone the Repository
Clone the Dryft source code from the repository:git clone <repository-url>
cd dryft
Build the Compiler
Compile the Dryft compiler using Cargo:The compiled binary will be available at target/release/dryftc. Add to PATH (Optional)
For easier access, add the compiler to your PATH:# Add to ~/.bashrc or ~/.zshrc
export PATH="$PATH:/path/to/dryft/target/release"
Or create a symbolic link:sudo ln -s /path/to/dryft/target/release/dryftc /usr/local/bin/dryftc
Verify Installation
Test your installation by checking the compiler version:
You should see output similar to:
Directory Structure
After installation, familiarize yourself with the project structure:
dryft/
├── src/ # Compiler source code
│ ├── main.rs # CLI entry point
│ ├── frontend/ # Parser and frontend
│ ├── backends/ # Code generation backends
│ └── targets/ # Target configuration files
│ ├── gcc.toml # GCC backend config
│ └── elf.toml # x86-64 assembly config
├── std/ # Standard library
│ └── io.dry # I/O functions
├── examples/ # Example programs
├── native/ # Native runtime components
├── build/ # Build artifacts (created during compilation)
└── Cargo.toml # Rust project configuration
Compilation Targets
Dryft supports multiple compilation targets configured via TOML files:
[unix]
backend = "C99"
dependencies = [ "gcc" ]
intermediate = "build/ir.c"
stdlib = "gcc native/stdc/std.c -c -fPIE -o build/stdc.o"
assemble = "gcc -c -o build/ir.o -w build/ir.c"
link = "gcc build/ir.o build/stdc.o -o a.out"
interpret = "./a.out"
The GCC backend (-t gcc) is the default and recommended target. The x86-64 backend (-t elf) is experimental and may not support all features.
Next Steps
Now that you have Dryft installed, you’re ready to write your first program!
Quick Start
Write and run your first Dryft program
Language Guide
Learn Dryft’s syntax and features in depth
Troubleshooting
Build fails with missing dependencies
If you see errors about missing Rust crates, ensure you have an active internet connection and try:
cargo clean
cargo build --release
“Unknown target” error
Make sure you’re running the compiler from the project root directory, or use --custom-target to specify the full path to a target TOML file:
dryftc --custom-target /path/to/gcc.toml input.dry
GCC or NASM not found
Verify that your backend toolchain is installed:
gcc --version
nasm --version
If not found, refer to Step 2 above to install the required tools.