Introduction to Zig
a project-based book
Welcome
Welcome! This is the initial page for the “Open Access” HTML version of the book “Introduction to Zig: a project-based book”, written by Pedro Duarte Faria. This is an open book that provides an introduction to the Zig programming language, which is a new general-purpose, and low-level language for building robust and optimal software.
Support the project!
If you like this project, and you want to support it, you can buy an eBook or a physical copy of the book on Amazon:
Sending donations directly
You can also donate some amount directly to the author of the project via:
- PayPal Donation.
- Revolut.
These are good ways to support directly the author of the project, which helps to foster more contents like this, and it makes possible for the author to keep writing helpful tools and materials for the community.
PayPal
Revolut
You can send money via Swift Payment with the following bank and Swift details:
Recipient: Pedro Duarte Faria
BIC/SWIFT Code: REVOSGS2
Account number: 6124512226
Name and address of the bank: Revolut Technologies Singapore Pte. Ltd, 6 Battery Road, Floor 6-01, 049909, Singapore, Singapore
Corresponding BIC: CHASGB2L
If you do have a Revolut account, you can scan the following QR code:
About this book
This an open (i.e. it is open-source), technical and introductory book for the Zig programming language, which is a new general purpose, and low-level programming language for building optimal and robust software.
Official repository of the book: https://github.com/pedropark99/zig-book.
This book is designed for both beginners and experienced developers. It explores the exciting world of Zig through small and simple projects (in a similar style to the famous “Python Crash Course” book from Eric Matthes). Some of these projects are: a Base64 encoder/decoder, a HTTP Server and an image filter.
As you work through the book, you will learn:
- The syntax of the language, and how it compares to C, C++ and Rust.
- Data structures, memory allocators, filesystem and I/O.
- Optionals as a new paradigm to handle nullability.
- How to test and debug a Zig application.
- Errors as values, and how to handle them.
- How to build C and Zig code with the build system that is embedded into the language.
- Zig interoperability with C.
- Parallelism with threads and SIMD.
- And more.
License
Copyright © 2024 Pedro Duarte Faria. This book is licensed by the CC-BY 4.0 Creative Commons Attribution 4.0 International Public License4.
Book compilation metadata
This book was compiled using the following versions of Zig and Quarto:
- System version: Linux, 6.8.0-48-generic, NA, x86_64.
- Zig version: 0.14.0-dev.2051+b1361f237.
- Quarto version: 1.5.57.
Book citation
You can use the following BibTex entry to cite this book:
@book{pedro2024,
author = {Pedro Duarte Faria},
title = {Introduction to Zig},
subtitle = {a project-based book},
month = {October},
edition = {1},
year = {2024},
address = {Belo Horizonte},
url = {https://github.com/pedropark99/zig-book}
}
Acknowledgments
This book is also a product of many conversations and exchanges that we had with different people from the Zig community. I (Pedro Duarte Faria) am incredibly grateful for these conversations, and also, for some direct contributions that we had. Below we have a list of the people involved (name of the person with their usename in GitHub):
Calin Martinconi (@martinconic), Steffen Roller (@sroller), Chris Boesch (@chrboesch), Lv Sihan (@Pokryton), saurabh sharma. (@esskayesss), slackline (@slackline), Markus Kurz (@kurz-m), Rubin Simons (@rubin55), Chris Boesch (@chrboesch), Bruno (@PoorlyDefinedBehaviour), Ilia Choly (@icholy), Korri Katti (@KorryKatti)