zag

Zag

Zag is a fork of Zig 0.15.2 focused on a different concurrency model.

The short version: Zag is exploring zero-infection structured concurrency. That means concurrency should live at the call site, not in function signatures. We do not want async fn coloring, and we do not want an Io parameter threaded through every layer of a program just because some leaf needs to block.

The current design direction is tracked in issue #1: ZEP-0002 Structured Async.

Why Zag Exists

Zag exists to test a language and runtime thesis:

The motivating argument is laid out in the early design issues:

The design position is straightforward:

Current Direction

Zag is currently a forked compiler/toolchain based on Zig 0.15.2.

The repo is in a transition state:

So this is not a finished language release. It is an active fork being shaped around a specific concurrency agenda.

What Has Landed So Far

Two user-visible changes are already in the tree:

That means the compiler currently accepts both:

The goal of .zag support right now is transitional compatibility while the language and runtime direction are being worked out.

Planned Model

The current proposal in issue #1 is centered on:

In other words, Zag is trying to preserve Zig-style direct code while gaining modern structured concurrency semantics.

Status

What works today:

What is still incomplete:

The main tracked backend blocker right now is:

Building Zag

Zag currently builds from source. There is not yet a polished binary release channel specific to Zag.

The current tree identifies itself against Zig 0.15.2 in build.zig.

A typical development build is:

zig build -Dno-lib -Dno-langref

If you want the LLVM-enabled path on macOS with Homebrew LLVM/LLD, the tree now supports an explicit Polly flag:

zig build \
  -Denable-llvm=true \
  -Dllvm-has-polly=true \
  --search-prefix /opt/homebrew/opt/llvm@20 \
  --search-prefix /opt/homebrew/opt/lld@20

That -Dllvm-has-polly=true option exists because Homebrew’s LLVM packaging on macOS needs extra help when linking the system LLVM stack.

Using .zag

The compiler currently treats .zag as Zag source code and routes it through the same source pipeline as .zig.

Examples:

zig build-exe hello.zag
zig test math.zag
zig fmt src/

The formatter, import handling, and file classification have already been wired so .zag and .zig can coexist during the transition.

Repository Shape

This repository is still mostly upstream Zig compiler source plus targeted Zag changes.

That is intentional for now. The goal is to keep rebasing possible while the fork proves out the runtime and language direction.

You should read the repo as:

Contributing

If you want to work on Zag, the most important thing is to understand the design intent before changing compiler code.

Start here:

Contributions are most useful when they align with that agenda rather than pushing Zag back toward upstream Zig’s concurrency model.

Summary

Zag is not trying to be “Zig with a different file extension”.

Zag is a fork of Zig pursuing a different answer to async and concurrency: plain functions, structured scopes, fiber-based scheduling, and a toolchain that accepts .zag while that model is being built out.