Introduction to Zig

a project-based book

Author

Pedro Duarte Faria

Published

November 17, 2024

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.

About the author

Pedro Duarte Faria have a bachelor degree in Economics from Federal University of Ouro Preto - Brazil. Currently, he is a Data Platform Engineer at Blip1, and an Associate Developer for Apache Spark 3.0 certified by Databricks.

The author have more than 4 years of experience in the data industry. Developing data products, pipelines, reports and analysis for research institutions and some of the largest companies in the brazilian financial sector, such as the BMG Bank, Sodexo and Pan Bank.

But Pedro is also a passionate software developer that loves to learn and teach about programming. Although Pedro uses many different languages in his work, he is specialized in the R programming language, and have given several lectures and courses about it, inside graduate centers (such as PPEA-UFOP2), in addition to federal and state organizations (such as FJP-MG3).

Personal Website: https://pedro-faria.netlify.app/

Linkedin: https://www.linkedin.com/in/pedro-faria-a68140209/

Mastodon: @pedropark99@fosstodon.org

Twitter (X): @PedroPark9

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}
}

Corresponding author and maintainer

Pedro Duarte Faria

Contact: pedropark99@gmail.com

Personal website: https://pedro-faria.netlify.app/

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)


  1. https://www.blip.ai/en/↩︎

  2. https://ppea.ufop.br/↩︎

  3. http://fjp.mg.gov.br/↩︎

  4. https://creativecommons.org/licenses/by/4.0/↩︎