我的个人博客

Home Blog Docs 编程 Zig文档 About
Go to Davirain's GitHub repo Menu

Directory

Back to Menu
Hello World 注释 (Comments) 值 (Values) 字符串字面量 (String Literals) 赋值 (Assignment) 未定义 (undefined) 解构 (Destructuring) Zig 测试 (Zig Test) 整数 (Integers) 浮点数 (Floats) 运算符 (Operators) 数组 (Arrays) 向量 (Vectors) 指针 (Pointers) 切片 (Slices) 结构体 (struct) 枚举 (enum) 联合 (union) 不透明类型 (opaque) 代码块 (Blocks) Switch 语句 (switch) While 循环 (while) For 循环 (for) If 表达式 (if) 推迟执行 (defer) 不可达 (unreachable) 编译时基础 (Basics At Compile-Time) 不返回 (noreturn) 函数 (Functions) 错误处理 (Errors) 可选类型 (Optionals) 类型转换 (Casting) 零位类型 (Zero Bit Types) Void 与结果位置语义 (Void and Result Location Semantics) 编译时 (comptime) 汇编 (Assembly) 原子操作 (Atomics) 异步函数 (Async Functions) 内置函数 (Builtin Functions) 非法行为 (Illegal Behavior) 内存管理 (Memory Management) 编译与源文件 (Compilation & Source) 入口点与标准库选项 (Entry Point & Std Options) Panic 处理器 (Panic Handler) 构建系统 (Zig Build System) C 语言集成 (C) WebAssembly 编译目标 (Targets) 风格指南 (Style Guide) 文档注释指南 (Doc Comment Guidance) 源文件编码 (Source Encoding) 关键字参考 (Keyword Reference) 附录 (Appendix) 容器 (Containers) 语法 (Grammar) Zig 之禅 (Zen) Zig 标准库 (Zig Standard Library) 变量 (Variables) 递归 (Recursion) 生命周期与所有权 (Lifetime and Ownership) 命令行接口 (CLI)

语法 (Grammar)

Zig 语言的完整语法规范。

由于语法规则较长且复杂,这里仅提供官方文档的链接:

Zig Grammar (Official Documentation)

Zig 的语法旨在易于解析(LL(1) 或接近 LL(1)),并且尽可能减少歧义。

Previous 容器 (Containers) Next Zig 之禅 (Zen)

© 2025 Davirain. All rights reserved.

Follow Davirain on Twitter Go to Davirain's GitHub repo