Welcome to the official documentation repository for the Zen C programming language. This repository contains the technical specifications, language reference, and standard library documentation.
The core of Zen C's power lies in its standard library. Detailed documentation for each module can be found in the std/ directory.
| Module | Description |
|---|---|
| vec | Dynamic array implementation. |
| string | Modern, safe string handling. |
| net | High-level networking (TCP, HTTP). |
| cuda | First-class GPU programming support. |
| thread | Concurrency and parallelism. |
| json | Built-in JSON serialization/deserialization. |
Note
For a high-level overview of the library, see the Standard Library README.
Deep dives into the compiler's internals and tooling protocols.
- Lexer Specification: Detailed breakdown of Zen C's tokens and grammar rules.
- Plugins: Blocks of other languages in Zen C, and how to write a plugin.
- Install: Building and installing Zen C on Linux, macOS and Windows.
- Changelog: Every change in each release.
- Migrations: What to change in your code for each release (0.4.4 to 0.5).
Zen C comes as the compiler and four tools, installed next to it. Tools has a page for each one:
| Tool | What it does |
|---|---|
zc |
Compiles a program: builds it, runs it, checks it or translates it to C. |
zc-format |
Indents a source file. |
zc-doc |
Writes the documentation of a file and its imports as Markdown. |
zc-repl |
Runs Zen C a line at a time. |
zc-lsp |
The language server, for editors. |
| # | Chapter | Description |
|---|---|---|
| 1 | Variables & Constants | let, types, mutability |
| 2 | Primitive Types | int, float, bool, char, etc. |
| 3 | Aggregate Types | Arrays, slices, tuples |
| 4 | Functions & Lambdas | Functions, closures |
| 5 | Control Flow | if, while, for, match |
| 6 | Operators | Arithmetic, comparison, sugar operators |
| 7 | Printing & F-strings | Output, string interpolation |
| 8 | Memory & Lifetimes | Ownership, borrowing |
| 9 | OOP | Traits, impl blocks, methods |
| 10 | Generics | Type-safe templates |
| 11 | Concurrency | Threads with std/thread.zc |
| 12 | Advanced | Inline assembly, raw blocks |
| 13 | Comptime | Compile-time evaluation and metaprogramming |
| 14 | Interop | C, C++, CUDA, Objective-C interop |
| 15 | Unit Testing | test, assert, expect |
| 16 | Diagnostics | Compiler warnings, categories |
| 17 | MISRA Rules | Safety rules, Zen-specific checks |
- zenc: The core compiler source code.
- awesome-zenc: A collection of examples and Rosetta Code implementations.
Documentation is a community effort. If you find a typo, outdated information, or want to contribute a new guide, please open a documentation issue or pull request.
Each released minor version of Zen C has its own branch here, so the documentation of a release does not change when the next one changes the language:
maindocuments the version in development, the next release (0.6 while 0.5 is the latest).release/X.Y(e.g.release/0.5) documents the released version X.Y and its patch releases (0.5.1, 0.5.2…). It is created frommainwhen X.Y is released, and from then on it only receives fixes.
Which branch your pull request goes to:
- New or changed behaviour (a new feature, syntax or standard library function, something that works differently from the last release):
main. - A fix to the documentation of a released version (a typo, a wrong example, something the release does but the docs describe wrongly):
main, and then the same commit cherry-picked ontorelease/X.Y(git cherry-pick -x <commit>). If the text has changed inmainsince the release, open a separate pull request againstrelease/X.Y. - A patch release (0.5.2): its changelog and any page it changes go to
release/0.5, and the changelog entry also tomain.
The website (docs.zenc-lang.org) publishes the latest release branch, release/0.5: pushes to main do not reach it.
When the compiler releases a new minor version X.Y, create release/X.Y from the commit of main that documents it, and main moves on to the next version. Then point the branches of .github/workflows/sync-docs.yml at release/X.Y, in both main and the new branch.
The website (zenc-lang-ce.github.io) publishes these pages through scripts/sync_to_site.sh. To see your changes as they will look there, clone the website next to this repository and run:
make serve # WEB=../zenc-lang-ce.github.io by default
make serve WEB=../path/to/website # if it is somewhere elseIt serves the site at http://localhost:1111/docs/ and updates it about half a minute after you save a file. It needs Python 3, rsync, and Zola 0.18.0 or Docker. make clean removes the copy it works on (.preview/).