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 bylib/std/zig/Parse.zig. - ZIR — Zig Intermediate Representation. The flat, untyped IR produced by
AstGen(lib/std/zig/AstGen.zig); encoded inlib/std/zig/Zir.zig. ZIR is per-file and is the unit of incremental compilation. - AIR — Analyzed IR. Produced by
Semaafter type checking andcomptimeevaluation. Defined insrc/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.zigthat lowers ZIR to AIR. - comptime — Compile-time evaluation. Code marked
comptimeruns insideSema. - ZON — Zig Object Notation. A subset of Zig used for
build.zig.zonand similar. Seelib/std/zon.zig,lib/std/zig/ZonGen.zig, andsrc/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.zigandlib/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
Semaand codegen. Seesrc/InternPool.zig.
Bootstrap and stages
- stage1 — The minimal
zigproduced frombootstrap.cplus CMake/LLVM. Used to build the rest. - stage2 — The self-hosted compiler in
src/produced by stage1 runningbuild.zig. - stage3 — Stage2 rebuilding itself; used as a reproducibility check in CI.
- only-c — A bootstrap mode (
-Donly-cinbuild.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 inlib/std/Build.zig.Step— A unit of work instd.Build(lib/std/Build/Step.zig).Cache— Content-addressed build cache inlib/std/Build/Cache.zig.Watch— File-watching used by--watchmode (lib/std/Build/Watch.zig).build_runner— The program embedded inzigthat runs a project'sbuild.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 viasrc/link/Lld.zig.- link.File — The output file owned by a linker (
src/link.zig). Subclasses live insrc/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 inlib/compiler/aro/. - resinator — Bundled Windows resource compiler (
zig rc).lib/compiler/resinator/. - objcopy —
zig objcopyimplementation inlib/compiler/objcopy.zig. - reduce — Bug-report minimizer (
zig reduce) inlib/compiler/reduce.zig. - doctest — Tooling under
tools/doctest.zigandtools/docgen.zigthat compiles, runs, and embeds Zig snippets intolangref.html. - incr-check —
tools/incr-check.zig, the harness that verifies incremental compilation against full rebuilds. - compiler_rt — Pure-Zig implementations of compiler-runtime intrinsics (
lib/compiler_rt/, rootlib/compiler_rt.zig).
Targets and ABI
- Target — A
(cpu, os, abi, ofmt)tuple; modeled inlib/std/Target.zig. - CPU feature — A boolean knob on a CPU model (e.g.
+avx2); tables generated bytools/update_cpu_features.zig. - libc target — A flavor of bundled libc:
glibc,musl,mingw,wasi,darwin,freebsd,netbsd. Each lives underlib/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 insrc/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.