ziglings
pacman.zig
Our great sponsors
ziglings | pacman.zig | |
---|---|---|
36 | 3 | |
4,098 | 198 | |
- | - | |
8.1 | 7.7 | |
2 months ago | 6 days ago | |
Zig | Zig | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ziglings
-
Roadmap to master zig
Master syntax - language possibilities, so that you can read code. Ziglings (or github) does great job teaching it!
-
Problems of C, and how Zig addresses them
I am interested to learn, how Traits in Rust and Interfaces in Go behave differently from this concept.
[1] https://github.com/ratfactor/ziglings/blob/main/exercises/09...
- Learning how to use the Zig build system.
-
What's the reasoning behind the iguana mascot, and why is Zig specifically named so?
Is Zero the space lizard (dinosaur?) with the hammer in the picture in Ziglings' readme? (I like this guy)
-
List of wanted examples?
Yesterday someone introduced me to ziglings, do you mean that? https://github.com/ratfactor/ziglings/tree/main/exercises
- Looking for feedback on new Ziglings Exercise 101 (multi-object 'for' loops and data-oriented design)
-
Curious noob peeks memory and wants to understand it 😅
Hi! I am learning zig through the Ziglings repo. I was messing around exercise 54 where it shows how you can create a pointer to many items instead of a slice:
-
What “sucks” about Zig?
Also, https://github.com/ratfactor/ziglings if you missed it.
-
Ask reddit: What learning resources have taught you the most about zig?
Along with ziglearn, I also found ziglings useful.
- Bun v0.5
pacman.zig
-
Zig and WASM
For a somewhat more complete example which runs in browsers, check out my little pacman.zig toy project [0]. This is cheating a bit by using Emscripten toolchain as 'sysroot' (needed for the Emscripten headers), and the Emscripten linker to create the html+js+wasm output file, but the actual code is all compiled with the Zig compiler.
The interesting part is that the platform abstraction is provided by the sokol headers [1], with auto-generated Zig bindings [2]. It's interesting because the C headers use "Emscripten magic" (mainly embedding Javascript snippets in the C sources via the EM_JS() macro), and the Zig compiler is able to compile this (when it has access to the Emscripten headers).
It would be nice if the "Emscripten platform" could get the same type of cross-compilation support as the desktop platforms eventually, but apart from bundling the Emscripten headers, this would also require to implement some of the "Emscripten magic" in the linker step.
Maybe projects like WaJIC can help with this (this basically implements the "Emscripten magic" of embedding Javascript snippets in C/C++ source code, but without Emscripten (only the wasm-opt tool is needed AFAIK).
Anyway... it's a lot of fun to tinker around with this stuff in Zig, and watch how it's all taking shape :)
[0] https://github.com/floooh/pacman.zig
- Cross-platform build with 3rd-party libraries?
-
To Learn a New Language, Read Its Standard Library
My advice would be: to learn a new language, start writing some non-trivial projects in it (a few thousand lines of code or so). In some languages (like Python), the standard library is the actually important feature, in other languages (like C), it better to mostly ignore the stdlib. Example: I started learning Zig by writing a Pacman clone (https://github.com/floooh/pacman.zig) and a home computer emulator (https://github.com/floooh/kc85.zig), the Pacman clone doesn't use any Zig stdlib features at all, and the emulator only minimally for parsing command line args and loading data from files.
Zig's stdlib is much more useful than C's, but it's still entirely possible to write useful programs without it and instead focus on learning Zig's language features first.
But on the other extreme, the whole point why I learned Python was its "batteries included" standard library.
What are some alternatives?
awesome-zig
SDL.zig - A shallow wrapper around SDL that provides object API and error handling
Rustlings - :crab: Small exercises to get you used to reading and writing Rust code!
zig-wefx - WEFX is a simple graphics drawing package using Zig, WASM, and an HTML canvas.
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
libcxx - Project moved to: https://github.com/llvm/llvm-project
nrf-hal - A Rust HAL for the nRF family of devices
julia - The Julia Programming Language
rust-koans - Koans for the Rust programming language
minimal-zig-wasm-canvas - A minimal example showing how HTML5's canvas, wasm memory and zig can interact.
xtensa-zig - Zig built against xtensa fork of LLVM for targetting ESP32
Dodgeballz - A mini game using Zig, WASM and JS