Everything on this page is built and tested: cross-checked against the language’s
compiler/src, mz harness definition, and the example programs CI runs through mz run
with their output compared, at language main f9bea2b, tagged v0.13.0 (the release of 1 November 2026,
mzizi#146; compiler/, examples/ and primitives/ are unchanged since v0.12.0, 9766929, the release of 29 October,
mzizi#140). On 29 October each
example, run with mz run from v0.12.0, printed exactly its .expected file. The fourth
release of 8 October 2026 (tagged v0.8.0, mzizi#109) carried the
rest of the text operations from mzizi#106.
The third release of that day (mzizi#104, tagged
v0.7.0) carried collections and records from
mzizi#99,
mzizi#101 and
mzizi#102, and the first text methods from
mzizi#98. The first release of that day
(mzizi#91) brought the functions, numbers,
control flow and errors. It is a slice of
RFC-0013,
not all of it: the rest of the RFC is design, and what is not built
lists it. The tracker rows these features belong to are C1–C10, every one ✅ in the file, so
M1 is met on main (what still has to be built).program <name> and its last is
end program <name>. It holds fns and, since control flow landed, enums; every statement
lives inside a fn. Exactly one fn main, with no parameters, is the entry point, and a
program’s output is what it prints. One program per file.
mz run checks a program, lowers it to a Rust package with no dependencies, builds it with
Cargo and runs it. mz build writes the same package. A program is the second thing in Mzizi
that lowers to Rust, after a service; no component lowers.
The smallest program
examples/hello.mz, verbatim:
examples/hello.mz
Functions, bindings and when
examples/fib.mz, verbatim. It recurses, binds with let and var, assigns, branches with
when and else, and interpolates.
examples/fib.mz
examples/fib.expected
fn name(a: int, b: text): int…end fn name: typed parameters, a return type or none, calls and recursion. Every path of a function with a return type returns (MZ0906); a wrong call isMZ0905, quoting the signature.letbinds a value once;varbinds one you assign with=. Scope is the block. There is no shadowing (MZ0921), a name is readable from the line after its binding to the end of its block (MZ0920), and assigning to aletisMZ0922. Python’s bare first assignment, Go’s:=and Rust’slet muteach get a fix.when/else when/else, closed byend. A condition is abooland nothing else: Mzizi has no truthiness (MZ0712).returnends a function early.print(value)writes one value’s text form and a newline; to print several, interpolate them into one text.- Comments are lines starting with
##.//and#areMZ0911, with##as theexactfix.
Values: int, float, bool and text
int and float never mix. 1 + 1.5 is MZ0912, with the exact fix 1.0 on an
int literal and the guess x.to_float() on anything else. A float prints in the shortest
form that reads back exactly: 1.0, 0.30000000000000004, 1.0e21, inf, nan.
The numeric methods are postfix, so -2.pow(2) is -(2.pow(2)):
Expressions and operators
Highest precedence first, as RFC-0013 §3.5 orders the operators that are built. Lower levels bind tighter. The level of each operator is the one the checker, the parser and the language harness all read:
Prefix
not binds looser than comparison, so not (a is b) is the form to write.
not a is b without the parentheses is MZ0910, whose exact fix is a is not b. Postfix
binds tighter than prefix -, so -2.pow(2) is -4, and 1 + 2 * 3 is 7.
Equality is is and is not. ==, !=, &&, || and ! are MZ0910, each with an
exact fix to the Mzizi word. += and ++ are MZ0918; str(x) and x.to_string() are
MZ0962, with the exact fix "{x}". examples/numbers.mz prints its arithmetic, and
numbers.expected
holds what it prints.
Control flow
Fromexamples/control.mz (an excerpt; the file is in the repository, and CI compares its
output with examples/control.expected):
examples/control.mz (excerpt)
match <value>takescaselines, each listing one or more values (case 6 7), then an optionalelse, over an enum, anint, atextor abool. It is checked for exhaustiveness: a missing case isMZ0930, naming the missing variants, and a case that can never run isMZ0931, whoseexactfix deletes it. Amatchover afloatisMZ0711: compare a float withwhen.for each i in range(a, to = b)counts fromaup to but not includingb.for eachalso runs over a list, andrange(a, to = b)is a list anywhere; see collections.while <condition>is the one conditional loop;while truewith abreakis the loop that ends from inside.breakandcontinueact on the innermost loop, and areMZ0935outside one.whenandmatchas values. Either may be the whole value of alet, avar, an assignment or areturn, each branch one expression line; nowhere else, and there is no ternary (MZ0932).- Other languages’ spellings are fixed.
elif,else if,switch,default:,case _and_ =>areMZ0933;for x in xs,for (const x of xs),loopandrange(n)areMZ0934, each with anexactfix. Anelse whenchain over one enum’s variants isMZ0936, with aguessfix rewriting it as amatch.
enum, one variant per line, closed by a bare end. A
variant is written bare where the expected type settles its enum, and <enum>.<variant>
where two enums share it. Variants compare with is, order by declaration and print as their
names. A variant may carry columns, a name and a literal each, read with a dot
(problem.say), as in examples/errors.mz below.
Errors: result, error and try
examples/errors.mz, verbatim:
examples/errors.mz
examples/errors.expected
- A function that can fail returns
result(T, E), orresult(none, E).return vreturns success,return error(e)returns failure, andreturn rpasses a result of the function’s own type through. - A caller matches the result, with exactly two cases,
case ok <name>andcase error <name>, or propagates its error with a prefixtry, in a function that returns a result with the same error type. - Any other use of a result is
MZ0950: discarding it, printing it, comparing it, passing it or holding it in avar. A result is never a parameter, nor inside another result. fn mainmay returnresult(none, E). When it returns an error, the program writesmz: error MZ0992: main returned an error: <the error's text form>to standard error and exits 1.- Other languages’ idioms are
MZ0952:Ok(v)(exactv),Err(e)(exacterror(e)), Rust’s postfix?(exactprefixtry),throw eandraise e(return error(e)), and.unwrap()and.expect(…), which have no fix: an error is never turned into a crash.
mz run
- Check. On any error it prints the diagnostics, exits 3, and does not build.
- Lower. It writes a Cargo package with no dependencies into
<name>-<path hash>under$MZ_CACHE_DIR, ormzizi/mz-run/under$XDG_CACHE_HOMEor~/.cache. With none of the three set it exits 2 and names them; it never falls back to the system’s temporary directory. - Build.
cargo build --offline --quiet, with--releasewhen asked. No dependencies means no network. - Run. The binary runs with the terminal’s standard input, output and error. Standard
output belongs to the program; everything
mz runwrites of its own goes to standard error.
mz run departs from the other commands, where 1 means
errors, because 1 belongs to the program it runs:
RFC-0013 §13 also designs exit 70 and
MZ0993 for a runtime failure, and mz run --agent
for NDJSON on standard error. Neither is built: mz run --agent exits 2.
The lowering. Every value is owned and no reference or lifetime is emitted: a text read
is a .clone(). result(T, E) is Rust’s Result<T, E> and try e is e?; an enum is a
Rust enum; a match on an enum or a bool has no _ arm unless it has an else, so
rustc checks exhaustiveness again; for each i in range(a, to = b) is for i in a..b. The
generated code holds no unwrap, expect, panic! or unsafe, which a test checks.
Nesting is capped
A program’s blocks and expressions nest at most 32 deep together, and an expression’s tree of binary operators at most 64. Past the cap is oneMZ0411 per file, not a stack overflow.
compiler/tests/robustness.rs holds every case to a 1 MiB stack.
Text methods (C6)
Text values have methods, written after the value as the numeric ones are. No method changes the text it is called on: each returns a new value, socity.trim() leaves city as it was.
Lengths, indices and slices count Unicode scalar values, so an index never lands inside a
character, and there is no char type: one character is a text of length 1. A method that
may find nothing returns an option, read with otherwise as the collections are.
parse_int uses RFC-0011 §4.2’s rule on purpose, so a query parameter and a parsed string agree.
examples/text.mz, verbatim, with the output it prints:
examples/text.mz
examples/text.expected
- Other languages’ spellings are
MZ0962, with fixes.len(s)gets theexactfixs.length(), since Python also counts scalar values.s.len(),s.size(),s.count()ands.lengthgets.length()as aguess, because Rust’slencounts bytes and JavaScript’slengthcounts UTF-16 units.strip()getstrim()as aguess, because Python’sstripalso removes U+001C to U+001F.upper(),toUpperCase(),startswithandreplaceAll(a, b)get their Mzizi names asexactfixes.int(s),float(s),parseInt(s)andparseFloat(s)on text gets.parse_int()ands.parse_float()asguesses,indexOfgetsfindandsubstringgetsslice, andtoCharArray()getschars. t in sisMZ0962, with anexactfix. On text,inasks about a collection, so the fix iss.contains(t), as RFC-0013 §3.3 says.- Emptiness is
s is "".s.is_empty(),s.length() is 0and their relatives are oneMZ0962, whoseexactfix iss is ""ors is not "". - Not built. Regular expressions, padding and number formatting. They are the standard
library’s (P2), which is not started, and formatting is interpolation until then. The owner
decided on 8 October 2026 (RFC-0013 §20 Q20) that built-in methods with tests meet C6’s “Done
when”; P2’s
textmodule documents the same operations once modules (P1) exist.
Collections (C7)
A program has three collection types:list(T), map(K, V) and set(K). A bracket literal
takes its type from the place it stands, so [3, 1, 3] is a list where a list is expected and
a set(int) where a set is. A literal that cannot be typed, such as [1, "two"], is MZ0961.
examples/collections.mz, verbatim, builds a list, a map and a set and transforms them in
functions. Its output is below it.
examples/collections.mz
examples/collections.expected
- Indexing returns an option.
xs[i]andm[k]arenonewheniis outside the list orkis not a key.x otherwise dgivesx, ordwhenxisnone. It binds below arithmetic and above comparison (RFC-0013 §3.5, level 6), and is right-associative. Using an option as its value withoutotherwiseisMZ0710. - Changing a collection needs a
var.xs[i] = vandm[k] = vset an element or a key, andm[k] = vadds the key when it is missing.xs[i] = vtraps wheniis outside the list (MZ0991, exit 101).push,insert,removeand indexed assignment on aletareMZ0960, whoseexactfix isvar. - Membership.
x in xsasks about an element,k in mabout a key, andx in sabout an element of a set.inon text isMZ0962, withs.contains(t)as the fix. - Keys have an order. A map key or set element that is a
float, a collection or an option isMZ0964. Maps and sets iterate and print in key order. Mzizi has no tuples:(a, b)isMZ0963. for eachover a list iterates the list as it was when the loop began. A map or a set isMZ0711, withkeys()orto_list()in its fix.- Functions passed to a method are named
fns of the program. A lambda,x => …, isMZ0909, with no fix. - A collection is a value.
let b = acopies it, and a function does not change the list its caller holds.
map and filter take a function of one element, fold takes its start value and a step
function of two, and group_by returns a map(K, list(T)).
Not built:
option(T)written as a type,noneas a value, and narrowing an option withwhen x is not none: the “C4 options” follow-up (RFC-0013 §18.2).- Tuples, which RFC-0013 §2 decided against.
- Labels on these calls other than
range’sto,slice’stoandfold’sstep.
say text and fix kinds, are in
the compiler’s table of the MZ09xx codes.
Records and methods (C8)
Arecord groups named fields, and its fns are methods that read the value through self.
A record may carry a contract of always clauses that every value must keep.
examples/records.mz, verbatim, with the output it prints:
examples/records.mz
examples/records.expected
- Built by field name.
point(x = 3.0, y = 4.0)is a value; built from positional values it isMZ0808, with no fix. A field the record lacks, or one given twice, isMZ0808too. - Copied with
with.p with (y = 0.0)is a new value with one field changed, andpis unchanged. Awiththat names a field the record does not have isMZ0974. - Fields and
vars. A field is read with a dot.q.x = 5.0changes a field of avar; changing a field of alet, or of a value no name holds, isMZ0960, whoseexactfix isvar. - Equality and text.
iscompares two records, and a record prints as its name and its fields, as inpoint(x = 3.0, y = 4.0). - Methods. A method’s receiver is
self, which is read and never assigned.selfoutside a method isMZ0970, and assigning toselfor one of its fields inside one isMZ0971. A method that needs a changed record returnsself with (…). alwaysclauses. Each clause is checked when a value is built, when awithcopies it, and after a field is assigned. A broken clause traps at run time (MZ0991, exit 101). A record literal that breaks one isMZ0975at check time.
fn … changes self and a record that holds itself (both MZ0919); payload enums
(RFC-0013 §11.5); a fix for a positional construction; and to_json. Generics and interfaces are a
separate row, P12, deferred past M1.
What is not built
These are designed in RFC-0013 and are not in the compiler onmain. Most are MZ0919, which
says the form is designed and not built; some, such as via, fall to generic codes (MZ0917):
- Generics and interfaces, a separate row, P12, deferred past M1.
option(T)written as a type,noneas a value, and narrowing an option withwhen x is not none(the “C4 options” follow-up, RFC-0013 §18.2).- A method that changes its record,
fn … changes self, and a record that holds itself (MZ0919), and payload enums (RFC-0013 §11.5). - A decimal type.
- Named arguments beyond
range’sto,slice’stoandfold’sstep,try … via f(MZ0955), and amatchstub as the fix forMZ0950. - A program’s
contractblock,mz test,mz run --agent, andmz outline,mz irandmz hashon a program, which exit 2. - Modules: one program per file, and nothing is imported.
MZ09xx code.