Open-Source Wikis

/

Zig

/

Applications

ziglang/zig

Applications

The zig binary is the only deployable artifact in this repository. Everything below is embedded inside it as a sub-command and lives under lib/compiler/ (the source of those sub-commands) or src/main.zig (the dispatch).

This section treats each major sub-command / embedded program as its own application.

Sub-commands

Page Sub-command(s) Source
zig (CLI) zig, top-level dispatch src/main.zig
build-runner zig build lib/compiler/build_runner.zig
test-runner zig test (the per-binary runner) lib/compiler/test_runner.zig
aro (C frontend) zig translate-c, parts of zig cc preprocessing lib/compiler/aro/
resinator zig rc (Windows .rc compiler) lib/compiler/resinator/
objcopy zig objcopy lib/compiler/objcopy.zig
reduce zig reduce (bug minimizer) lib/compiler/reduce.zig
translate-c zig translate-c lib/compiler/translate-c/
std-docs zig std (autodoc browser) lib/compiler/std-docs.zig

The full list of sub-commands also includes the C/C++ toolchain shims (cc, c++, ar, lib, ranlib, dlltool); those route through src/main.zig directly to clang/LLVM glue rather than to a separate program in lib/compiler/.

How dispatch works

src/main.zig's mainArgs reads argv[1] and dispatches:

  • Self-hosted compilation paths (build-exe, build-lib, build-obj, test, run, test-obj) construct a Compilation.
  • Project workflow (build, init, fetch) call into lib/compiler/build_runner.zig (build), lib/init/ templates (init), or src/Package/Fetch.zig (fetch).
  • Source tooling (fmt, ast-check, reduce, translate-c) call into src/fmt.zig, the parse path in lib/std/zig/, lib/compiler/reduce.zig, and lib/compiler/translate-c/ respectively.
  • Toolchain shims (cc, c++, ar, lib, ranlib, dlltool, rc, objcopy) invoke clang via src/zig_clang_*.cpp, LLVM via src/zig_llvm.cpp / src/zig_llvm-ar.cpp, lib/compiler/resinator/, or lib/compiler/objcopy.zig.
  • Introspection (env, targets, version, libc, std, zen, help) is handled in-line in src/main.zig (some delegate to src/print_*.zig).
graph LR
  Argv["argv[1]"] --> M["src/main.zig dispatch"]
  M --> Comp["build-exe / build-lib / build-obj / test / run"]
  M --> Build["build → build_runner.zig"]
  M --> Fmt["fmt → src/fmt.zig"]
  M --> Init["init → lib/init/"]
  M --> Fetch["fetch → src/Package/Fetch.zig"]
  M --> Aro["translate-c → lib/compiler/aro + translate-c"]
  M --> Reduce["reduce → lib/compiler/reduce.zig"]
  M --> Res["rc → lib/compiler/resinator"]
  M --> Obj["objcopy → lib/compiler/objcopy.zig"]
  M --> CC["cc/c++/ar/lib/ranlib/dlltool → clang/LLVM glue"]
  M --> Std["std → lib/compiler/std-docs.zig"]
  M --> Misc["env/targets/version/libc/zen/help → src/print_*.zig"]

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

Applications – Zig wiki | Factory