ZEN C
Modern Ergonomics.
Zero Overhead.
Pure C.
A strictly typed systems language that brings pattern matching, traits, and ownership semantics to the C ecosystem.
import "std/net.zc"
def PORT = 8080;
fn main() {
println "Listening on :{PORT}";
let res = TcpListener::bind("0.0.0.0", PORT);
guard res.is_ok() else {
eprintln "Bind failed: {res.err}";
return;
}
let listener = res.unwrap();
defer listener.close();
loop {
let client = listener.accept();
async handle_client(client);
}
}
Native C Interop
100% ABI compatible. Includes C headers directly, supports raw function pointers, and compiles to standard C11/GNU C.
Resource Semantics
Move-by-default semantics and RAII (Drop trait) prevent double-free errors without the overhead of a garbage collector.
Metaprogramming
Execute code at compile-time with comptime, embed binary assets, and use smart
attributes for optimization.
Pattern Matching
Destructure enums, match against ranges, and use guards for powerful control flow compared to switch statements.
Generics
Write reusable, type-safe code with zero runtime overhead using monomorphized generics and trait bounds.
Concurrency
Built-in async/await for high-performance I/O operations without complex
callback hell.
Polyglot Architecture
Zen C adapts to your ecosystem. Link seamlessly with existing codebases.
CUDA
--cudaWrite GPU kernels with Zen syntax using launch and @global attributes.
@global
fn add(a: float*, b: float*) {
let i = thread_id();
a[i] += b[i];
}
C++
--cppGenerate C++ compatible code to link against libraries. Instantiate templates in raw
blocks.
raw {
std::vector<int> get_vec() {
return {1, 2, 3};
}
}
Objective-C
--objcNative macOS support. Mix [Object message] syntax within your systems code.
raw {
id pool = [[NSPool alloc] init];
[pool drain];
}
First-Class Tooling
LSP Support
Built-in Language Server provides Go-to-Definition, Hover, Completion, and Diagnostics.
Interactive REPL
Experiment instantly with zc repl. Features persistent history and benchmarking.
Portable Builds
Compile to APE (Actually Portable Executable) to run one binary on any OS.
Sustain the Project
Zen C is strictly Open Source and community-funded. Contributions via Open Collective ensure the longevity of the infrastructure.
View Open Collective →Support daily maintenance.
- ✓ Badge on GitHub
- ✓ Discord Role
Fuel new features.
- ✓ All Backer rewards
- ✓ Early RFC access
- ✓ Logo in README
Tailored solutions.
- ✓ Priority Support
- ✓ Logo on Homepage
Start Compiling
git clone https://github.com/z-libs/Zen-C.git
make
sudo make install
make ape