Reading paths
The guide has one order, and the arrows at the bottom of each page follow that order. The paths below are shortcuts. Each path is a list of chapters for one starting point. Every link goes to the same chapter as the link in the sidebar.
New to systems programming
You wrote software before, but never in a language that made you say where a value is in memory. Start in Groundwork. Groundwork teaches the machine, not the language, and assumes no C. Then read the first two sections completely.
- Everything Is BytesSystems from Scratch
- Numbers Have a SizeSystems from Scratch
- Memory Is NumberedSystems from Scratch
- The StackSystems from Scratch
- Who Owns This MemorySystems from Scratch
- Off the EndSystems from Scratch
- When the Checks Are OffSystems from Scratch
- Strings Are BytesSystems from Scratch
- Structs Are LayoutSystems from Scratch
- Errors Are ValuesSystems from Scratch
- Talk to the Operating SystemSystems from Scratch
- InstallationGetting Started
- Hello WorldGetting Started
- Run TestsGetting Started
- AssignmentLanguage
- ArraysLanguage
- If ExpressionsLanguage
- While LoopsLanguage
- For LoopsLanguage
- FunctionsLanguage
- DeferLanguage
- ErrorsLanguage
- PointersLanguage
- SlicesLanguage
- OptionalsLanguage
- StructsLanguage
- AllocatorsStandard Library
- ArrayListStandard Library
Then read Data Structures, which makes you decide who frees what. Or read the From Scratch track, which makes you build the tools that you use.
From C
You already know pointers, the stack and undefined behaviour. Do not read the tour. Read the parts where Zig is different from C, then go directly to the C interop chapters.
- Hello WorldGetting Started
- Integer RulesLanguage
- Runtime SafetyLanguage
- PointersLanguage
- Many-item PointersLanguage
- SlicesLanguage
- Sentinel TerminationLanguage
- ErrorsLanguage
- DeferLanguage
- ComptimeLanguage
- AllocatorsStandard Library
- C Primitive TypesWorking with C
- C PointersWorking with C
- ABIWorking with C
- Import CWorking with C
- Cross-compilationBuild System
Then read the Cookbook. It shows, in Zig, the programs that you wrote in C before.
From a garbage-collected language
Go, Java, C#, Python, JavaScript. The syntax is not the difficult part. Memory and error handling are difficult, so this path puts both first.
- Hello WorldGetting Started
- Run TestsGetting Started
- OptionalsLanguage
- ErrorsLanguage
- DeferLanguage
- PointersLanguage
- SlicesLanguage
- AllocatorsStandard Library
- Recipe: Catch Memory LeaksHow-To
- ArrayListStandard Library
- Hash MapsStandard Library
- StringsStandard Library
- String RecipesStandard Library
- ComptimeLanguage
- The Io InterfaceStandard Library
Then read Concurrency. Your old runtime also did concurrency for you.
Build it from scratch
You learn a thing when you write it. This path is the main line of the From Scratch track: the primitives that a shell needs, the tools that you use every day, a language, and a web server. Each one is a complete program. If one stage interests you, the track has more chapters on it.
- String PrimitivesSurvive the Terminal
- Tokenize a Command LineSurvive the Terminal
- The Read-Eval-Print LoopSurvive the Terminal
- catUnix Tools
- wcUnix Tools
- sortUnix Tools
- makeUnix Tools
- A LexerTiny Language
- A ParserTiny Language
- A Tree-Walking InterpreterTiny Language
- Parse an HTTP RequestWeb Server
- An HTTP ServerWeb Server
Then read the chapters that this path does not include: grep and printf, the bytecode compiler and its VM, and the rest of the web server.
Ship something this week
You will read about the language later. This path is the shortest route to a program that reads input, does work, and writes a result.
- InstallationGetting Started
- Hello WorldGetting Started
- AllocatorsStandard Library
- ArrayListStandard Library
- Command-Line ArgumentsStandard Library
- FilesystemStandard Library
- JSONStandard Library
- Recipe: Load a JSON ConfigHow-To
- Recipe: Word FrequenciesHow-To
- Zig BuildBuild System
- Build ModesBuild System
- Cross-compilationBuild System
Then select the recipe that matches what you build.
Write a network service
A server, a client, or any program that uses a protocol. The framing chapters decide if your program continues to work on a real network. Thus they come before the chapters where the sockets do most of the work.
- Readers and WritersStandard Library
- The Io InterfaceStandard Library
- What a Socket IsNetworking
- A TCP Round TripNetworking
- Bytes Have No EdgesNetworking
- Three Ways to FrameNetworking
- A Text Protocol, Both DirectionsNetworking
- Binary Protocols and Byte OrderNetworking
- Serve Many ClientsNetworking
- Failure Is OrdinaryNetworking
- Recipe: A Redis RESP Round TripHow-To
- Parse an HTTP RequestWeb Server
- An HTTP ServerWeb Server
- Routes and Query StringsWeb Server
- Serve Files SafelyWeb Server
Then read about form bodies, sessions and templates, or the PostgreSQL wire protocol for a larger service.
Upgrade from an older Zig
Your code compiled on 0.13 or 0.14, and it does not compile now. Read what moved, then read the four areas that moved the most.
- Migrate from an Older ZigGetting Started
- The Io InterfaceStandard Library
- Readers and WritersStandard Library
- FormattingStandard Library
- ArrayListStandard Library
- ArraysLanguage
Then run your own test suite again against a master build.
If no path fits, use the section list. It shows the full guide, and the first chapter of Getting Started is the start of the full reading order.