Why Zebra?
A program should say what it assumes.
Most bugs are an assumption nobody wrote down: this list is never empty, this user always exists, this call never fails. Zebra gives each of those a place in the program where the compiler, or the running program, holds you to it.
What it is for
- What a function needs and what it promises are written as
requireandensure, and what is always true of a class asinvariant. They are checked every time the code runs, release builds included; only--turboremoves them. - A value that may be missing says so in its type:
str?may be nil andstrmay not, and the compiler will not let you read through the first until you have handled nil. - A union lists every case it can be, and a
branchover it must handle each one. Add a case and every place that forgot it stops compiling. - A function that can fail says
throws, and each call either passes the error on with?or handles it withcatch. - Tests live in the file they test, and
zebra testruns them.
All of this sits inside a syntax shaped like Python's, because the checks should not cost the program its readability. Programs compile ahead of time to native executables.
What it is not
- Not a scripting language. A program is compiled before it runs;
zebra file.zbrcompiles and runs in one step, but there is no interpreter. - No class inheritance. Shared code comes from mixins
(
class Dog adds Barking) and polymorphism from interfaces (class Dog implements Animal). - Not finished. Zebra is before 1.0, so the language can still change, and each change is listed in the changelog. Open bugs are public, in BUGS.md.
- Not a claim about speed. Zebra has not been benchmarked against other languages, so this site does not say how fast it is.
Where it comes from
Cobra. Cobra, created by Chuck
Esterbrook from about 2005, was a language for .NET that put Python's syntax together with
contracts, nil tracking and tests written beside the code. Zebra began around the start of 2026 as a
Zig backend inside the Cobra repository and became its own project in April 2026. It keeps
Cobra's surface (indentation, def, var, contracts) and its
concern with quality, but not its type system, runtime or library. The name is Zig and
Cobra put together.
Eiffel. require, ensure,
invariant and old are Design by Contract, from Bertrand Meyer's
Eiffel.
Python. The shape of the syntax: indentation for blocks, no semicolons,
for x in xs. The Python page lists where Zebra
differs.
Zig. The compiler emits Zig, and Zig's toolchain turns it into an executable. The toolchain ships inside each release, so there is nothing else to install. A second backend, through V, is in progress.
Built with itself
The Zebra compiler is written in Zebra. The first compiler was written in Zig; once the Zebra version could do everything it did, the Zig one was retired, in September 2026. The test suite compiles the compiler with itself twice and requires the two results to be identical, byte for byte. The IDE and the TAOCP exercises are written in Zebra too.
Acknowledgements
- Chuck Esterbrook and the contributors to Cobra, which Zebra grew out of.
- Bertrand Meyer, for Eiffel and Design by Contract.
- The Zig project, whose toolchain builds every Zebra program.
- libui-ng, for native GUI widgets; SQLite, which ships inside Zebra; and Scintilla, the editor component in zebra-ide.
- Donald Knuth, whose The Art of Computer Programming supplies the exercises in zebra-taocp.