Zag is a systems language focused on clean, expressive syntax without giving up explicit control, predictable performance, or native compilation. It compiles to Zig, letting the Zig toolchain handle code generation, linking, and cross-compilation.
Hello, Zag
Features
- Whitespace-sensitive, no semicolons, no braces
- Expressions and routines produce values when used
- Types optional in source, required by code generation
funyields a value,subis for effects=for bindings,=!for constants — no let/var/const keywords- Prefix and postfix
if,while,for,match - Structs, enums, error sets, tagged unions
- Pipe
|>, range.., power** - Compiles to readable Zig source
Quick Start
zig build # build the compiler ./bin/zag test/examples/hello.zag # emit Zig source (default) ./bin/zag -t test/examples/hello.zag # dump token stream ./bin/zag -s test/examples/hello.zag # print S-expressions ./bin/zag -r test/examples/hello.zag # compile and run
Pipeline
Zag source → S-expressions → type resolution → Zig source → native binary.
The parser is generated by Nexus, a universal grammar engine shared across projects.