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.

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

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
Oct 16, 2020

The Zig programming language is a relatively recent entrant into the “systems programming” realm; it looks to interoperate with C, while adding safety features without sacrificing performance. The language has been gaining some attention of late and has announced progress toward a Zig compiler written in Zig in September. That change will allow LLVM to become an optional component, which will be a big step forward for the “maturity and stability” of Zig.


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