Library / SDK
zenc-lang/zenc avatar
zenc-lang/zenc

zenc: gnu23 by default, C11 output, and two ways to find the standard library

Write like a high-level language, run like C.

4,320 stars226 forksCMIT

At a glance

What is it?
A systems language that compiles to human-readable GNU C and keeps full C ABI compatibility, built by a Makefile that probes the host compiler twice, branches on Windows to set exactly one variable, and compiles a standard library path that ZC_ROOT can override at run time.
Who is it for?
Use zenc if you want C output you can read and C ABI compatibility you can rely on, and build it with make on a host where gnu23 is available so the build does not fall back to gnu11.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 20 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • zenc-lang/zenc4,320 ★ · +8
Star history
Repository2026-09-232026-11-15
zenc-lang/zenc4.3k4.3k

8 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The Windows branch of the Makefile sets one variable

The build opens with an operating system check, `ifeq ($(OS),Windows_NT)`, and its only real job is deciding whether `EXE` is empty or `.exe`. Every other assignment inside the two branches is identical: `RM = rm -rf`, `MKDIR = mkdir -p`, `CP = cp -af`, `LN = ln -sf` and `INSTALL = install` appear on both sides, line for line. Windows gets the same POSIX-shaped commands as everything else, which fits the note that `make` works there under MSYS2, Cygwin or git-bash, but it means the branch selects no different set of tools. It selects an executable suffix and nothing else.

The Windows story the quick start tells is otherwise separate from make. It points at a batch script, with GCC (MinGW) present, and that script produces the compiler as `zc.exe`. Networking, filesystem and process operations are named as fully supported on Windows through a platform abstraction layer. So the path a new Windows user is steered toward is the batch script, and make on Windows is the documented alternative for people who already have a Unix-like environment.

gnu23 is the build default while the overview promises C11

Output language and build language are two separate settings here, and the overview is explicit about the first: Zen C compiles to human-readable GNU C and C11. The compiler that produces that output is built under a different default, `C_STD ?= gnu23`, guarded by a probe that tries the requested standard and warns, `Compiler does not support -std=$(C_STD), falling back to gnu11`, when the host rejects it.

The Makefile then asks the compiler two questions. One compiles a throwaway `int x;` to find out whether the standard exists at all. The second compiles `constexpr int x = 42; int main(void){return x;}`, because the comment above it says GCC 14 and up support constexpr while Clang's C23 is partial. Only when that second probe succeeds is `-DHAS_CONSTEXPR` added to the defines, so what the compiler believes it can do is decided by a feature test rather than by compiler identity. TCC gets a separate branch, since it does not support `-MMD -MP`, may not search `/usr/local/include`, and maxes out at C11, which forces its standard to `gnu11` whatever you pass on the command line.

WERROR already defaults to 1, so one documented target is a no-op

`WERROR ?= 1` means warnings are treated as errors unless a caller overrides it. The development target list therefore includes one line that cannot change a build: `make WERROR=1` restates the value the file already carries. The way to turn the behaviour off is `make WERROR=0`, which appears nowhere in the quick start.

The rest of that list does change things, and the comments spell out what each one runs. `make format` sends clang-format over the source files, `make format-check` verifies formatting without touching files, `make lint` combines format-check with shellcheck on the test scripts, and `make bench` runs the performance benchmarks. The lint line is narrower than the tooling actually in the tree, which also holds `.clang-tidy`, `.pre-commit-config.yaml`, `.editorconfig`, and `flake.nix` with a `flake.lock` beside it.

The default compiler is gcc, and the two overrides are spelled out in comments at the top of the file: `make CC=clang` for clang, and `make CC="zig cc"` for zig, the latter needing the quotes because the value contains a space.

The version string is assembled from a tag, a file, and a CI run number

Version identity is decided in three steps. `git describe --tags --always --dirty` runs first, and if it returns anything that becomes `GIT_VERSION`. If it returns nothing, the build falls back to reading the `.version` file, and if that file is missing too, to the literal string `unknown`. A third step checks whether `GITHUB_RUN_NUMBER` is set and, when it is, appends `+ci.<run number>` to whatever the first two steps produced. The result is compiled in as `-DZEN_VERSION`.

So three different builds report three different things. A clean tagged checkout reports the tag, an untagged checkout reports a commit hash or `unknown`, and any CI build reports a string that is not a release version at all. The tags on record here are v0.4.4 from 2026-03-20, v0.4.3 from 2026-03-12 and v0.4.2 from 2026-02-26, while the branch itself was pushed on 2026-10-26. A binary built from current `main` therefore reports a value past the newest tag, and it will not match any release you can download.

Two build systems sit in the root and only one is documented

The root holds a `Makefile`, a `CMakeLists.txt`, `build.bat` for Windows, `flake.nix` with a `flake.lock` for Nix, and a `.pre-commit-config.yaml`. The quick start exercises the Makefile on Unix and the batch script on Windows, and says nothing about the CMake file or the flake. Whether they are three equivalent entry points or whether two of them are leftovers cannot be read off the tree, which makes the build system something you check yourself rather than something the project tells you.

Two other root files hint at how much of this is machine-maintained. `src-sources.txt` sits beside `src/`, and `LICENSES/` sits beside `LICENSE`, which is the arrangement a repository uses when it carries per-file licensing for more than one license. The package declares MIT, and `MANGLING.md` sits beside the sources to describe how names are mangled. That file matters more here than in most languages, because the stated goal is 100% C ABI compatibility: anything you export has to survive the rules that govern C symbols.

The rest of the tree is organised the same way, with `fuzz/`, `plugins/`, `man/`, `ape/`, `tests/`, `scripts/` and `std.zc` next to `std/`.

The portable build emits a compiler and a bootstrap installer

Cosmopolitan Libc is supported as an alternative output shape. With the `cosmocc` toolchain on your PATH, `make ape` and `sudo env "PATH=$PATH" make install-ape` produce two files. `out/bin/zc.com` is the compiler, with the standard library embedded inside the executable. `out/bin/zc-boot.com` is something else: a self-contained bootstrap installer for setting up new Zen-C projects. One target therefore yields a toolchain and an installer, and only the first appears in the usage section.

The reach of that format is stated precisely: Linux, macOS, Windows, FreeBSD, OpenBSD and NetBSD, on x86_64 and aarch64. Nothing has to be installed to use it, since the standard library travels inside the binary.

bash
make ape
sudo env "PATH=$PATH" make install-ape
bash
# Run on any supported OS
./out/bin/zc.com build hello.zc -o hello

One wrinkle in the install line: it passes your PATH through sudo, so the root shell can find `cosmocc` on your PATH.

The standard library is located twice, at build time and at run time

Finding `std/` is the one thing this project solves in two separate ways. The Makefile bakes a location into the binary with `SHAREDIR ?= /usr/local/share/zenc` and `-DZEN_SHARE_DIR="$(SHAREDIR)"`, so a system install has a compiled-in answer. The same define line carries `-DZC_ALLOW_INTERNAL`, a flag with no counterpart anywhere in the quick start and no explanation attached to it.

At run time the answer can be replaced. Setting `ZC_ROOT` points the compiler at a standard library location, which is what lets `zc` run from any directory, and the standard import form given as an example is `import "std/vec.zc"`. The library itself is written in Zen C and shipped in two shapes: `std.zc` at the root as one file, and `std/` as the tree, with per-module documentation referenced from `docs/std/README.md`. The module table begins at `std/bigfloat.zc`, described as arbitrary-precision floating-point arithmetic.

bash
export ZC_ROOT=/path/to/Zen-C

The ecosystem table grades its own editor support Alpha

A status column is attached to every repository in the ecosystem table. The core compiler, CLI and standard library are marked Active Development; the documentation, the RFC repository, the website and the Vim plugin are marked Active; the curated example list is marked Growing; and the VS Code extension, described as syntax highlighting and snippets, is the single row marked Alpha. Editor support is the part of the toolchain the project itself rates least finished, and the two official plugins do not do the same amount of work: indentation and syntax for Vim against highlighting and snippets for VS Code. Feature proposals go through the RFC repository, and discussion happens on a Discord server.

The showcase section names three programs written in the language: a Pong clone for the Nintendo 3DS, a basic example built on Parin, and a minimal web browser, the first two on GitHub and the browser on a sourcehut repository. Seven translations of the readme sit under `translations/`, and the language switcher at the top of the English one names German, Russian, Simplified and Traditional Chinese, Spanish, Italian and Brazilian Portuguese.

Editorial conclusion

Use zenc if you want C output you can read and C ABI compatibility you can rely on, and build it with make on a host where gnu23 is available so the build does not fall back to gnu11. Verify three things before you rely on it: which compiler CC resolves to, because the constexpr and C23 probes branch on it; whether the version your binary reports matches a tag, since anything newer than v0.4.4 will report a commit hash or a CI suffix instead; and where std comes from, since SHAREDIR is compiled in and ZC_ROOT replaces it at run time. If you need Windows without a Unix-like environment, build.bat is the documented path, because the Makefile's Windows branch changes nothing beyond the executable suffix.

Frequently asked questions

Is C still in demand?

The project says nothing about demand for C. What it states is a design position: Zen C compiles to human-readable GNU C and C11 and keeps 100% C ABI compatibility, so anything callable from C stays callable from the generated code.

How do you build the zenc compiler on Windows?

Run the provided batch script with GCC (MinGW) available, and it produces the compiler as `zc.exe`. Networking, filesystem and process operations are supported there through the platform abstraction layer, and `make` under MSYS2, Cygwin or git-bash is the stated alternative.

What does make ape produce in zenc?

Two files: `out/bin/zc.com`, the portable compiler with the standard library embedded inside the executable, and `out/bin/zc-boot.com`, a self-contained bootstrap installer for new Zen-C projects. Both need the `cosmocc` toolchain on your PATH, and the install target re-exports PATH under sudo.

How does zc locate the standard library?

Two ways. The build bakes a default in with `SHAREDIR ?= /usr/local/share/zenc` and `-DZEN_SHARE_DIR`, and at run time `ZC_ROOT` overrides it so the compiler can run from any directory, with imports written as `import "std/vec.zc"`.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. zenc-lang/zenc on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/zenc-lang-zenc.svg)](https://hysenlabs.com/projects/zenc-lang-zenc)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/zenc-lang-zenc.svg)](https://hysenlabs.com/projects/zenc-lang-zenc)

Was this useful?