The Zig programming language specification.
  • C 84.9%
  • Makefile 15.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-09 16:43:05 -07:00
grammar Workaround a bug in peg(1) causing a compile error 2026-07-09 09:46:59 +02:00
.gitignore Added grammar 2018-11-14 09:17:16 +01:00
LICENSE Initial commit 2018-11-14 08:58:34 +01:00
README.md readme: embrace the word "informal" 2026-08-09 16:43:05 -07:00
ZigLanguageSpecification.md readme: explain some stuff 2026-08-09 13:44:47 -07:00

Zig Programming Language Specification

Language Reference

https://ziglang.org/documentation/master/

This document is intended to be the complete set of information that Zig users need to look at while coding.

It should explain all the features of the language and answer any questions that might arise. However it is not a tutorial and there is no narrative. It is also insufficient for implementing a compiler.

This document is outside the scope of the specification efforts of this project. It lives in the ZSF reference implementation of Zig.

Informal Specification

This document lives at ZigLanguageSpecification.md.

The entire document is non-normative. It is meant to communicate intent. The intended audience is not Zig users, but Zig project contributors. This document meticulously answers the question "how is the Zig Programming Language supposed to behave?" in plain English.

Thus, this document may contain contradictions due to the ambiguity of English language. Such contradictions help to flesh out how we want the Zig Programming Language to work. The Mechanized Specification will identify such contradictions, and then the resolutions to those ambiguities should be accounted for in the Informal Specification.

In this way, the Informal Specification acts as a mediator between the desired behavior of the language from a messy, human perspective, and the cold, hard reality of mathematics. Sometimes, the Informal Specification should be adjusted to match the Mechanized Specification, which has implications for compiler development, and sometimes the Mechanized Specification should be adjusted to account for the pragmatic needs of compiler development and human intuition.

Mechanized Specification

This is the Zig Programming Language encoded into formal verification software, for the purposes of mathematically proving things about programs written in Zig.

Examples of this would be CompCert, written in Rocq, or the WebAssembly specification, written in SpecTec.

Efforts to produce a mechanized specification of Zig are only just getting started and organized. Contributions welcome.