PUBLIC DEVELOPMENT
vacac is a handwritten, statically compiled compiler for Vaca 🐮. It parses and checks source in Rust, generates native LLVM object code with Inkwell, then invokes cc to link an ELF executable.
This compiler currently supports Linux only. For Windows/macOS, please use Docker or WSL2.
A CodeTease project.
- Rust and Cargo
- LLVM 23
- A C linker available as
cc
Build with:
cargo build --releaseCompile a Vaca source file (the object file is retained next to the executable):
target/release/vacac examples/factorial.vca -o factorial
./factorialFor a quick compile-and-run without leaving build artifacts:
target/release/vacac examples/factorial.vca --runRun the lexer, parser, and semantic checker without producing build artifacts:
target/release/vacac examples/factorial.vca --checkWrite the verified LLVM IR module to a text file without linking an executable:
target/release/vacac examples/factorial.vca --emit-llvm factorial.llSelect emitted-code optimization with -O0, -O1, -O2, or -O3:
target/release/vacac examples/factorial.vca -O2 -o factorialThe precise non-moving mark/sweep garbage collector is enabled by default. Use --gc=off for the legacy leak-until-exit allocation mode:
target/release/vacac examples/factorial.vca -O3 -o factorial
target/release/vacac examples/factorial.vca --gc=off -O3 -o factorial-legacyThe precise collector uses a non-moving generational nursery and sliced major cycles while preserving pins and raw-pointer addresses; VACA_GC_GENERATIONAL=0 and VACA_GC_INCREMENTAL=0 select the legacy full-major fallback. See Precise garbage collection for thresholds, generation and slice controls, stress testing, std::gc statistics, and native pinning.
Start at the documentation index.
- Using the compiler — build, CLI modes, linker inputs, and output-path safety.
- Diagnostics — parser recovery and human-readable/JSON error formats.
- Examples — complete programs to check, compile, and run.
- Testing — Rust tests, the example runner, and the adversarial corpus.
- Standard library — prelude
Option/Result,std::*modules, strings, vectors, math, I/O, files, environment, time, random, debug helpers, traits, maps, sets, and deques. - C FFI — scalar, string, and raw-pointer
extern "C"declarations and native linking. - Language reference — Vaca types, values, and statements, with links to the rest of the language guide.
The examples/ directory contains complete programs that can be checked or compiled with vacac:
target/release/vacac examples/enum_match.vca --check
target/release/vacac examples/enum_match.vca -o enum_match
./enum_matchSee Examples for the full list, including traits, modules, arrays, structs, closures, and C FFI.
Run the Rust unit and integration tests with:
cargo testSee Testing for the example runner, the deterministic adversarial corpus, and the precise-GC benchmark harness.