Open-Source Wikis

/

Zig

/

Zig

/

Glossary

ziglang/zig

Glossary

Project-specific vocabulary used in the source. Most of these terms are visible as type names or file names in the compiler.

Pipeline terms

  • AST — Abstract Syntax Tree. Defined in lib/std/zig/Ast.zig, produced by lib/std/zig/Parse.zig.
  • ZIR — Zig Intermediate Representation. The flat, untyped IR produced by AstGen (lib/std/zig/AstGen.zig); encoded in lib/std/zig/Zir.zig. ZIR is per-file and is the unit of incremental compilation.
  • AIR — Analyzed IR. Produced by Sema after type checking and comptime evaluation. Defined in src/Air.zig.
  • MIR — Machine IR. A backend-private SSA-ish form between AIR and emitted bytes. Each hand-written backend has its own Mir.zig (e.g. src/codegen/x86_64/Mir.zig, src/codegen/aarch64/Mir.zig).
  • Sema — Short for "semantic analysis". The fixed-point evaluator in src/Sema.zig that lowers ZIR to AIR.
  • comptime — Compile-time evaluation. Code marked comptime runs inside Sema.
  • ZON — Zig Object Notation. A subset of Zig used for build.zig.zon and similar. See lib/std/zon.zig, lib/std/zig/ZonGen.zig, and src/Sema/LowerZon.zig.
  • Zoir — A ZON-specific IR. See lib/std/zig/Zoir.zig.

Module model

  • Zcu — Zig Compilation Unit. The compiler's view of all analyzed declarations across all modules in one compilation. See src/Zcu.zig.
  • Module — A package of Zig source rooted at a single file. Tracked in src/Package.zig and lib/std/Build/Module.zig.
  • Decl — A top-level declaration inside a Zcu, with an associated ZIR/AIR/value.
  • InternPool — The interned table of types, values, and strings shared between Sema and codegen. See src/InternPool.zig.

Bootstrap and stages

  • stage1 — The minimal zig produced from bootstrap.c plus CMake/LLVM. Used to build the rest.
  • stage2 — The self-hosted compiler in src/ produced by stage1 running build.zig.
  • stage3 — Stage2 rebuilding itself; used as a reproducibility check in CI.
  • only-c — A bootstrap mode (-Donly-c in build.zig) that translates the compiler through the C backend so it can be ported to new hosts.

Build system

  • std.Build — The user-facing build API in lib/std/Build.zig.
  • Step — A unit of work in std.Build (lib/std/Build/Step.zig).
  • Cache — Content-addressed build cache in lib/std/Build/Cache.zig.
  • Watch — File-watching used by --watch mode (lib/std/Build/Watch.zig).
  • build_runner — The program embedded in zig that runs a project's build.zig (lib/compiler/build_runner.zig).

Backends and linkers

  • Backend — A consumer of AIR that emits machine code or another IR. src/codegen/llvm.zig, src/codegen/x86_64/, src/codegen/aarch64/, src/codegen/c.zig, etc.
  • use_lld / LLD — When the LLVM backend is used, linking can be delegated to LLD via src/link/Lld.zig.
  • link.File — The output file owned by a linker (src/link.zig). Subclasses live in src/link/Elf.zig, src/link/MachO.zig, src/link/Coff.zig, src/link/Wasm.zig, src/link/SpirV.zig, src/link/C.zig.

Tools and helpers

  • aro — Bundled C frontend used by zig translate-c. Lives in lib/compiler/aro/.
  • resinator — Bundled Windows resource compiler (zig rc). lib/compiler/resinator/.
  • objcopyzig objcopy implementation in lib/compiler/objcopy.zig.
  • reduce — Bug-report minimizer (zig reduce) in lib/compiler/reduce.zig.
  • doctest — Tooling under tools/doctest.zig and tools/docgen.zig that compiles, runs, and embeds Zig snippets into langref.html.
  • incr-checktools/incr-check.zig, the harness that verifies incremental compilation against full rebuilds.
  • compiler_rt — Pure-Zig implementations of compiler-runtime intrinsics (lib/compiler_rt/, root lib/compiler_rt.zig).

Targets and ABI

  • Target — A (cpu, os, abi, ofmt) tuple; modeled in lib/std/Target.zig.
  • CPU feature — A boolean knob on a CPU model (e.g. +avx2); tables generated by tools/update_cpu_features.zig.
  • libc target — A flavor of bundled libc: glibc, musl, mingw, wasi, darwin, freebsd, netbsd. Each lives under lib/libc/<flavor>/.
  • C ABI — Tested by test/c_abi/.

Misc

  • Air.zig — The file that defines AIR; spelled all-caps because the IR is the noun.
  • Tracy — Profiler hooks in src/tracy.zig. Enabled at build time.
  • Crash report — Custom panic/abort handler in src/crash_report.zig.
  • bad O(N) — A documented marker in src/main.zig (pub const @"bad O(N)" = void;) used to flag inappropriate linear searches that should be fixed.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Glossary – Zig wiki | Factory