Introduction
Zig is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.
⚡ A Simple Language
Focus on debugging your application rather than debugging your programming language knowledge.
- No hidden control flow.
- No hidden memory allocations.
- No preprocessor, no macros.
⚡ Comptime
A fresh approach to metaprogramming based on compile-time code execution and lazy evaluation.
- Call any function at compile-time.
- Manipulate types as values without runtime overhead.
- Comptime emulates the target architecture.
⚡ Maintain it with Zig
Incrementally improve your C/C++/Zig codebase.
- Use Zig as a zero-dependency, drop-in C/C++ compiler that supports cross-compilation out-of-the-box.
- Leverage zig build to create a consistent development environment across all platforms.
- Add a Zig compilation unit to C/C++ projects; cross-language LTO is enabled by default.
Links
- Official Website: https://ziglang.org/
- Github: https://github.com/ziglang/zig
- Learn Zig:https://ziglearn.org/
- Get Start: https://ziglang.org/learn/getting-started/
- Community: https://github.com/ziglang/zig/wiki/Community
- Zig 语言中文社区(Zig Chinese Community): h
t t p s : / / z i g l a n g . c c /
Installation
$ brew install zig
Sample code:
const std = @import("std");
pub fn main() anyerror!void {
std.log.info("Hello world!", .{});
}
Outputs:
$ ./zig-out/bin/z
info: Hello world!