Dec 21, 2021

This release features 6 months of work: changes from 177 different contributors, spread among 2023 commits.

One sentence summary: The Toolchain “just works” in more cases, many bugs were fixed, the Self-Hosted Compiler is 44% complete, the Support Table is expanded, there were a handful of Language Changes, the project started Performance Tracking, and the Standard Library, although unstable, became more useful.

Sep 23, 2021

After using code coverage information and real-world files to improve an audio metadata parser I am writing in Zig, the next step was to fuzz test it in order to ensure that crashes, memory leaks, etc were ironed out as much as possible.

The problem was that I had no idea how to fuzz Zig code. While Zig uses LLVM and therefore in theory has access to libFuzzer, the necessary integration with SanitizerCoverage has yet to be implemented (see also this comment on a closed PR), so I figured I would try to to find another avenue in the meantime.

Read More
Aug 7, 2021

I think that it was the Pragmatic Programmer that recommend that you should learn a new language a year. For me, in 2020 that was Rust. I read a bunch of books about the language, I read significant amount of code and wrote some non trivial amount of code in Rust. That was sufficient to get me to grok the language, I’m not a Rust developer by any mean, but I walked with Rusty shoes for long enough to get the feeling.

This year, I decided to look into Zig. Both Zig and Rust are more or less in the same space, replacing C. They couldn’t be more different, however. Zig is a small language. I spent a couple of evenings going through the language reference and that was it, I had a pretty good idea about how to do things.

The learning curve is mostly flat, and that is pretty huge. This is especially because I can’t help but compare Zig to Rust. I spent a lot of effort understanding Rust, but I had spent almost no cycles trying to grok Zig. It was simple, obvious and quite clear.  In terms of power, mind, I would rate both languages on roughly the same spot. You can write really nice code in Zig, it is just that you don’t need to bend your head into funny shapes to get the compiler to accept your code.

Read More
May 22, 2021

During a recent stage 2 meeting Jakub Konka wanted to demo his progress on WASM support, but ran into problems with screen-sharing on Linux. After switching to his Mac to run it there, he found out that Wasmtime (a WASM runtime) doesn’t ship aarch64-macos pre-built binaries.

But Wasmtime is an open-source Rust project, I should be able to clone the repo and build it for Jakub myself. The problem? I don’t have an M1 Mac on hand. I will have to cross-compile.

May 13, 2021

Building a programming language from scratch is no easy feat. In addition to creating the compiler, defining the standard library, and supporting tools like editors and build systems, you need to design the language — will it be imperative or functional? What systems will the language be used for? Will it have metaprogramming capabilities? 

Zig, a member of our Open Source and Nonprofit Program, is a general-purpose programming language and toolchain for maintaining optimal and reusable software. It’s simple yet robust, and has portable SIMD. For the team working on Zig, the decision to build a language that was intentionally designed for their needs wasn’t made lightly. To learn more about what inspired this journey, we sat down with Loris Cro, one of the team members working on the project.  

Read More

ELF is an object format that is widely used in Linux and other modern operating systems. I wanted to learn about it to become more fluent in low-level code as well as start contributing to the zig self-hosted ELF linker backend.

This post will go through how I learned about the ELF format and applied it to create a minimal linker. I then used this linker on some x86_64 brainfuck code. The next post will go over how I linked and created the brainfuck code, since it relates to this “linker” a little.

Read More
Jan 7, 2021

I’ve been interested in giving Zig a spin for quite a while, and once my Raspberry Pi Zero W2 and OLED display3 arrived in the post, I decided that this would be my best opportunity to try it out. I’m not really going to cover the process of wiring up the hardware, suffice to say that once you’ve got your Pi Zero you’ll need to be able to SSH into it, and that you’ll need a [solderless] GPIO header4 to plug the OLED display into. I recommend the Zero W because the W means ‘WiFi’, which means that if you connect it to your network you can SSH in without faffing around with USB cables and what not. It’s not a requirement, though.

With that out of the way, let’s see if we can write something in Zig to power this little display. It’s going to be a simple program that simply fills the entire screen by turning the pixels from black (off) to white (on). As an extra challenge, we will do this without pulling in dependencies like WiringPi5, or relying on existing drivers, as lovely as they are.

Read More

Futureproof is a live editor for GPU shaders, built on Zig, Neovim, and WebGPU.

It’s designed for a quick feedback loop, recompiling shaders and marking errors live!

The name is tongue-in-cheek, because it builds on as many unproven new technologies as possible:

  • It is written in Zig, which is a “better C”

  • The editor is an embedded Neovim, which is a modernized Vim

  • Graphics are done with WebGPU, which is an in-development next-gen API

The system also uses FreeType for font rasterization and GLFW for windowing, but those are both relatively mature, so I don’t get any points for them.

Read More

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

Warning: the latest major release is 0.7 - Zig is still pre-1.0; usage in production is still not recommended and you may run into compiler bugs.

To follow this guide, we assume you have:

Prior experience programming

Some understanding of low-level programming concepts

Knowing a language like C, C++, Rust, Go, Pascal or similar will be helpful for following this guide. You should have an editor, terminal and internet connection available to you. This guide is unofficial and unaffiliated with the project, and is designed to be read in order from the start.

Read More

A community for the Zig programming language.

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

Created on Oct 16, 2020
By @root