{"id":14990747,"url":"https://github.com/pedropark99/zig-book","last_synced_at":"2025-05-14T16:01:45.769Z","repository":{"id":241422385,"uuid":"806791377","full_name":"pedropark99/zig-book","owner":"pedropark99","description":"An open, technical and introductory book for the Zig programming language 📚📖","archived":false,"fork":false,"pushed_at":"2025-03-20T22:36:21.000Z","size":29111,"stargazers_count":1309,"open_issues_count":23,"forks_count":76,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-06T09:01:32.457Z","etag":null,"topics":["book","course","programming","programming-language","tutorial","tutorial-course","zig","ziglang"],"latest_commit_sha":null,"homepage":"https://pedropark99.github.io/zig-book/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedropark99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-27T23:06:42.000Z","updated_at":"2025-04-05T20:47:16.000Z","dependencies_parsed_at":"2024-05-28T08:34:30.389Z","dependency_job_id":"4dda95e0-bde6-4fb9-b3b4-210783409947","html_url":"https://github.com/pedropark99/zig-book","commit_stats":{"total_commits":277,"total_committers":4,"mean_commits":69.25,"dds":"0.014440433212996373","last_synced_commit":"3eea7e30a5aae86d1017a9f9209add5d29d67561"},"previous_names":["pedropark99/zig-book"],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropark99%2Fzig-book","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropark99%2Fzig-book/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropark99%2Fzig-book/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropark99%2Fzig-book/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedropark99","download_url":"https://codeload.github.com/pedropark99/zig-book/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248716644,"owners_count":21150357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["book","course","programming","programming-language","tutorial","tutorial-course","zig","ziglang"],"created_at":"2024-09-24T14:20:43.814Z","updated_at":"2025-04-13T12:39:37.998Z","avatar_url":"https://github.com/pedropark99.png","language":"Zig","readme":"# Introduction to Zig\r\n\r\n\u003ca href=\"\"\u003e\u003cimg src=\"Cover/cover-artv3.png\" width=\"250\" height=\"366\" class=\"cover\" align=\"right\"/\u003e\u003c/a\u003e\r\n\r\nHey! This is the official repository for the book \"Introduction to Zig: a project-based book\", written by Pedro Duarte Faria.\r\nTo know more about the book, checkout the [About this book](#about-this-book) section below.\r\nYou can read the current version of the book in your web browser: \u003chttps://pedropark99.github.io/zig-book/\u003e.\r\n\r\nThe book is built using the publishing system [Quarto](https://quarto.org)\r\nin conjunction with a little bit of R code (`zig_engine.R`), that is responsible for calling\r\nthe Zig compiler to compile and run the Zig code examples.\r\n\r\n\r\n## Support the project!\r\n\r\nIf you like this project, and you want to support it, you can buy a PDF, eBook or a physical copy\r\nof the book, either at Amazon, or at Leanpub:\r\n\r\n- Amazon: \u003chttps://www.amazon.com/dp/B0DJYMDRLP\u003e\r\n- Leanpub: \u003chttps://leanpub.com/introductiontozigaproject-basedbook\u003e\r\n\r\n### Sending donations directly\r\n\r\nYou can also donate some amount directly to the author of the project via:\r\n\r\n- PayPal Donation.\r\n- Revolut.\r\n\r\nThese are good ways to support directly the author of the project, which helps to foster\r\nmore contents like this, and it makes possible for the author to keep writing helpful tools and\r\nmaterials for the community.\r\n\r\n### PayPal\r\n\r\n[![PayPal](https://img.shields.io/badge/PayPal-003087?logo=paypal\u0026logoColor=fff)](https://www.paypal.com/donate/?business=D58J5LFEERC3N\u0026no_recurring=0\u0026item_name=These+donations+make+it+possible+for+me+to+continue+writing+new+and+useful+content+for+our+community%F0%9F%98%89+Thank+you%21%E2%9D%A4%EF%B8%8F%F0%9F%A5%B3\u0026currency_code=USD)\r\n\r\n\r\n### Revolut\r\n\r\nYou can send money via Swift Payment with the following bank and Swift details:\r\n\r\n```\r\nRecipient: Pedro Duarte Faria\r\nBIC/SWIFT Code: REVOSGS2\r\nAccount number: 6124512226\r\nName and address of the bank: Revolut Technologies Singapore Pte. Ltd, 6 Battery Road, Floor 6-01, 049909, Singapore, Singapore\r\nCorresponding BIC: CHASGB2L\r\n```\r\n\r\nIf you do have a Revolut account, you can scan the following QR code:\r\n\r\n\u003chttp://revolut.me/pedroduartefaria\u003e\r\n\r\n\r\n\r\n\r\n## About this book\r\n\r\nThis is an open (i.e., open-source), technical and introductory book for the [Zig programming language](https://ziglang.org/),\r\nwhich is a new general purpose, and low-level programming language for building optimal and robust software.\r\n\r\nOfficial repository of the book: \u003chttps://github.com/pedropark99/zig-book\u003e.\r\n\r\nThis book is designed for both beginners and experienced developers. It explores the exciting world of Zig through small\r\nand simple projects (in a similar style to the famous \"Python Crash Course\" book from Eric Matthes).\r\nSome of these projects are: a Base64 encoder/decoder, a HTTP Server and an image filter.\r\n\r\nAs you work through the book, you will learn:\r\n\r\n- The syntax of the language, and how it compares to C, C++ and Rust.\r\n- Data structures, memory allocators, filesystem and I/O.\r\n- Optionals as a new paradigm to handle nullability.\r\n- How to test and debug a Zig application.\r\n- Errors as values, and how to handle them.\r\n- How to build C and Zig code with the build system that is embedded into the language.\r\n- Zig interoperability with C.\r\n- Parallelism with threads and SIMD.\r\n- And more.\r\n\r\n\r\n\r\n## How to build the book\r\n\r\nThis book depends on the three main pieces of software:\r\n\r\n1. The [Zig compiler](https://ziglang.org/download/), which is responsible for compiling most of the code examples exposed in the book.\r\n2. The [R programming language](https://cran.r-project.org/), which provides some useful tools to collect the code examples exposed across the book, and send them to the zig compiler to be compiled and executed, and also, collect the results back to include them in the book.\r\n3. The [Quarto publishing system](https://quarto.org/docs/get-started/), which provides the useful tools to compile the book, creating internal links, references, a chapters structure, the HTML content of the book, etc.\r\n\r\nSo, you first need to install these three pieces of software in your current machine.\r\nYou can find instructions on how to install these pieces of software by clicking in the above hyperlinks.\r\n\r\n### Install R packages\r\n\r\nAfter you installed the three pieces of software listed above, you should run the `dependencies.R` R script, to install\r\nsome R packages that are used across the book. Just run the command below in your terminal, and you should be fine.\r\n\r\nOBS: If you are on Linux or MacOS, this command will probably take some time to run, because every single dependency gets built from source.\r\nIn Windows, this usually doesn't take that long because pre-built binaries are usually available.\r\n\r\n```bash\r\nRscript dependencies.R\r\n```\r\n\r\n### Render the book\r\n\r\nIf you installed Quarto correctly in your computer\r\n, you should be able to build the book by simply executing\r\nthe following command in the terminal.\r\n\r\n```bash\r\nquarto render\r\n```\r\n\r\n### How the Zig compiler is found\r\n\r\nSome R code (`zig_engine.R`) is used to collect the Zig code examples\r\nfound across the book, and send them to the Zig compiler, so that they\r\ncan be compiled and executed.\r\n\r\nBut in order to do that, this R code needs to find the Zig compiler installed\r\nin your machine. This search process is done in two stages.\r\nFirst, it uses the [`Sys.which()` function](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Sys.which)\r\nto find the path to the Zig compiler in your computer, which is just a R interface to the `which` command line tool.\r\n\r\nThis is a fast and easy approach, but, it doesn't work in all situations, specially if\r\nyour Zig compiler is not installed in a \"standard location\" in your computer. That is\r\nwhy, a second strategy is applied, which is to search through the PATH environment variable.\r\n\r\nIt gets the value of your PATH environment variable, and iterates through the directories listed\r\nin this variable, trying to find the Zig compiler in one of them. This approach is much\r\nslower than the first one, but is more garanteed to work.\r\n\r\n\r\n\r\n## License\r\n\r\nCopyright © 2024 Pedro Duarte Faria. This book is licensed by the CC-BY 4.0 Creative Commons Attribution 4.0 International Public License.\r\n\r\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by/4.0/88x31.png\" /\u003e\u003c/a\u003e\r\n","funding_links":["https://www.paypal.com/donate/?business=D58J5LFEERC3N\u0026no_recurring=0\u0026item_name=These+donations+make+it+possible+for+me+to+continue+writing+new+and+useful+content+for+our+community%F0%9F%98%89+Thank+you%21%E2%9D%A4%EF%B8%8F%F0%9F%A5%B3\u0026currency_code=USD"],"categories":["Zig"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedropark99%2Fzig-book","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedropark99%2Fzig-book","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedropark99%2Fzig-book/lists"}