Compiling Programs
Zeus ships three commands for working with source files:
| Command | What it does |
|---|---|
zeus run [file] | Compile and immediately execute (no binary left behind) |
zeus check [file] | Check for errors without producing any output |
zeus build [file] | Compile to a binary you keep |
zeus run
The fastest way to execute a Zeus program during development. Compiles in debug mode to a temporary file, runs it, then discards the binary.
zeus run main.zsUse this while iterating — no build artifacts to clean up, one command instead of two.
zeus check
Runs all compilation passes (parsing, type checking, IR lowering) and reports any errors, but stops before generating a binary. Useful for catching mistakes quickly without waiting for code generation.
zeus check main.zsThis is also what the language server uses under the hood to provide inline diagnostics.
zeus build
Compiles your program into a binary you can distribute or run repeatedly. By default it produces a debug build — fast to compile, easy to inspect. Add --release for a fully optimized binary.
# Debug build (default)zeus build main.zs
# Release buildzeus build main.zs --releaseDebug vs Release
| Debug | Release | |
|---|---|---|
| Compile time | Fast | Slower |
| Optimization | None | Full |
| Binary size | Larger | Smaller |
| Incremental cache | Yes | No (full rebuild) |
| Output directory | target/debug/ | target/release/ |
Output Layout
target/ debug/ obj/ ← cached object file per source file bin/ ← executabletarget/ release/ obj/ ← single merged object file bin/ ← executableFlags
# Custom output pathzeus build main.zs -o /usr/local/bin/myapp
# Custom target directoryzeus build main.zs --target-dir /workspace
# Release build with custom outputzeus build main.zs --release -o /usr/local/bin/myappHow Release Compilation Works
Release mode applies whole-program optimization by merging all source files into a single compilation unit before optimizing — similar in spirit to link-time optimization (LTO).
Why a single unit?
When all source files are compiled together, the optimizer can inline across file boundaries, eliminate dead code from imported modules, and apply deeper optimizations. This produces binaries that are typically both smaller and faster than per-file compilation at the same optimization level.
Inspecting Compiler Output
Set the ZEUS_DEBUG environment variable to dump the low-level compiler output alongside the object file:
ZEUS_DEBUG=1 zeus build main.zs --releaseThis writes two files to target/release/obj/:
target/release/obj/program.o ← object filetarget/release/obj/program.ll ← low-level compiler outputThe .ll file shows exactly what the optimizer produced — useful for understanding inlining decisions and dead code removal.