Zero Documentation
Concise, example-driven Zero reference. Read the concept, see the code, then practice it in a Coddy journey.
Getting Started
- What Is ZeroZero is an experimental systems programming language from Vercel Labs designed so AI agents are first-class users — not just humans. Here's what it is and why it exists.
- Install ZeroInstall the Zero compiler and toolchain with a single curl command. Here's how to install it, put it on your PATH, and verify the install with `zero --version`.
- Hello, WorldYour first Zero program — what every piece of the canonical hello-world means, how to run it with `zero run`, and why even a five-line program already uses `World`, `raises`, and `check`.
- Zero CLIA tour of the `zero` command-line tool: the subcommands you'll use day-to-day, what each one outputs, and how the `--json` flag turns every command into a machine-readable feed for agents.
- Zero PackagesHow a Zero package is laid out: the `zero.json` manifest, the `src/` directory, and the targets system that lets one package produce executables, libraries, and tests from the same source tree.
Language Basics
- Let BindingsHow `let` works in Zero: declaring local bindings, type inference and explicit annotations, and why Zero uses a single binding form instead of multiple keywords.
- Primitive TypesThe built-in types Zero gives you out of the box: signed and unsigned integers of every width, floats, booleans, characters, strings, and the empty type Void.
- FunctionsHow functions work in Zero: the `fun` keyword, typed parameters, return types, the `pub` visibility modifier, and the role of `raises` in the function signature.
- If/ElseHow `if` and `else` work in Zero: boolean conditions, branch bodies, the absence of truthy coercion, and how conditionals fit alongside `match` for richer branching.
- While LoopsHow `while` loops work in Zero today: the condition, the loop body, the absence of `for` and `do-while` in the early language, and what loops have to do with explicit effects.
Data Modeling
- Shape (Structs)Shapes are Zero's struct-like product types. Here's how to declare them, construct values, read fields, and pass them through functions — with examples from the official samples.
- GenericsHow generics work in Zero: declaring type parameters on functions and shapes, calling generic functions, and the type-alias pattern that turns long parameterizations into clean names.
- EnumsHow `enum` works in Zero: declaring a fixed set of named variants, comparing values, and the line between `enum` (plain tags) and `choice` (tagged unions).
- Choice & MatchHow `choice` declares a tagged union in Zero and how `match` exhaustively branches on its variants — Zero's version of sum types and pattern matching.
Effects & Errors
- World CapabilityZero has no global stdout, no ambient filesystem, no implicit network. Everything that touches the outside world flows through a `World` capability passed into `main`. Here's why and how.
- Raises & CheckZero functions declare their failure modes with `raises` and callers acknowledge them with `check`. Here's how the system works, why there's no silent throw, and how it interacts with the `World` capability.
Agent Tooling
- JSON DiagnosticsZero's compiler emits machine-readable JSON diagnostics with stable error codes and structured repair plans. Here's the format, why it exists, and how an agent consumes it.
- Agent-First DesignZero is built around a single question: what does a programming language look like when AI agents are first-class users from day one? Here are the principles and the trade-offs.