Skip to main content
The Dryft compiler (dryftc) provides a command-line interface for compiling Dryft source files and launching an interactive REPL.

Usage

dryftc [OPTIONS] [INPUTFILE]
If no input file is provided, the compiler launches in REPL mode.

Arguments

INPUTFILE
path
Path to the Dryft source file to compile. If omitted, launches the interactive REPL.

Options

Target Selection

-t, --target
string
default:"gcc"
Specifies the compilation target. Must be one of the targets defined in src/targets/.Available built-in targets:
  • gcc - Compiles to C99 and uses GCC for final compilation
  • elf - Compiles directly to x86-64 assembly using NASM
Example:
dryftc -t elf program.dry
--custom-target
path
Path to a custom target TOML descriptor file. Use this to define your own compilation pipeline.Example:
dryftc --custom-target my-target.toml program.dry

Output Control

-a, --assembly-out
path
Specifies the output file path for the generated intermediate representation (IR).The file extension depends on the backend:
  • C99 backend: .c file
  • x86 backend: .asm file
Example:
dryftc -a output.c program.dry
--assembly-only
boolean
default:false
Only outputs the final Dryft assembly (IR). No external tooling (assembler, linker) will be called.Use this when you want to inspect the generated IR or handle compilation manually.Example:
dryftc --assembly-only -a output.c program.dry
--object-only
boolean
default:false
Only outputs an object file without additional library linking. The assembly step runs, but the final linking step is skipped.Example:
dryftc --object-only program.dry

Execution

-r, --run
boolean
default:false
Runs the final executable immediately after compilation using the pre-defined interpreter from the target specification.Example:
dryftc -r program.dry

Examples

Basic Compilation

Compile a Dryft program using the default GCC target:
dryftc hello.dry
This produces a.out executable in the current directory.

Compile and Run

Compile and immediately execute:
dryftc -r hello.dry

Using Different Targets

Compile using the x86 backend:
dryftc -t elf program.dry

Inspecting Generated Code

Generate C99 code without compiling:
dryftc --assembly-only -a output.c program.dry

Custom Target

Use a custom target definition:
dryftc --custom-target ./my-wasm-target.toml program.dry

Exit Codes

The compiler uses standard exit codes:
  • 0 - Successful compilation
  • Non-zero - Compilation error or invalid arguments

Build docs developers (and LLMs) love