Draft v0.9 — 2026
Zith is a statically typed systems programming language with a small, composable core and a large toolbox for domain-specific work. It proves memory safety at compile time without a garbage collector or borrow checker.
Zith gives you full control with a minimal & clean syntax — you don't have to choose between verbose but safe or readable but slow. Its memory model, Node Resource Analysis (NRA), proves ownership and lifetime safety using five keywords: lend, view, unique, share, and belong — plus a default (no keyword) modifier.
Beyond memory safety, Zith has a general-purpose core with a much larger toolbox: markers, contexts (DSLs), words (custom operators), comptime. You choose when to use them. Zith also follows the Rule of Three: "if a function needs more than three specialized tools, something went wrong."
This document is a draft of language specification, currently v0.9. It serves three audiences: developers learning Zith for the first time, contributors working on the zithc compiler, and tooling authors building editors, linters, or other infrastructure around the language.
| Symbol | Meaning |
|---|---|
?T |
Optional type — T or null (§8.1) |
T! |
Result type — T or an error (§8.1) |
? / ! (postfix) |
Unwrap an optional / result, propagating or falling back (§8.3) |
@name |
Compiler intrinsic or macro invocation (§11.3, §15) |
#name |
Variable or field attribute, e.g. #thread_local or #volatile |
:: |
Scope resolution — reach past a shadowed name (§2.3) |
If you are looking for just a 'new' language, clone or 'normal', so Zith is not for you. Zith was created for people starting to learn or open-minded, to discover new ways to think and structure your code, while having a powerful, readable, safe & expressive language.
Zith aims to be small and stable at its core — covering everyday needs — while offering a large kit that helps in specific domains where most languages need a lot of tricks to work. The compiler is a copilot: it gives you the tools, and you build the systems.
| Everyday | Domain-specific |
|---|---|
struct, fn, lend, view, trait, interface |
marker, dock, jump — for Games, State Machine, OS & embedded |
?T, T!, or |
context, word — for DSLs and APIs |
when, for, -> |
async — for data pipelines |
comptime) as a first-class feature.Macros and words should ideally live inside a context block. Activating them globally is possible but discouraged — the same code smell as using namespace std; in C++.
// Preferred
use SQL {
// SQL words and macros active only here
}
// Discouraged
use SQL; // pollutes the rest of the file
The zithc compiler follows a multi-stage pipeline:
source -> lex -> scan -> resolve(import/symbols) -> sema -> comptime -> NRA -> HIR -> LLVM
Note: when you compile a library, after LLVM it outputs
.zirl(Zith Intermediate Representation Library).
| Stage | Description |
|---|---|
source |
Receive arguments from CLI, load the file |
lex |
Tokenize the file into a TokenStream |
scan |
Find top-level declarations from the token stream |
resolve |
Resolve imported symbols, report duplicates |
sema |
Semantic analysis — name resolution, type checking, visibility |
comptime |
Generic instantiation, macro expansion, comptime evaluation |
NRA |
Apply NRA to ensure memory safety |
HIR |
Build High-level IR — desugared, typed, NRA-validated |
LLVM |
Code generation via the LLVM backend |
.zirl files serve as cache and distribution format for compiled libraries — no headers needed, OS-agnostic, and you choose static or dynamic linking at the client side. Distribute once, link however the consumer prefers.