Reference
Diagnostics
Diagnostics are a first-class feature. The compiler reasons about what you were trying to express and offers a literal correction — never a stack trace.
What a diagnostic shows you
A Zornux error tells you the code, where it happened, what went wrong in plain English, and how to fix it:
text
error[ZX0103]: I expected 'end' to close this 'if' block.
--> minor.zx:1:1
|
1 | if age is less than 18
| ^ this block is still open
|
help: add 'end' on a new line after the last statement of the block.
Authoring rules
- Speak to a beginner — "I expected…", "I could not find…", never "unexpected token".
- Name what was expected and what was found, in human terms.
- Offer a fix when one is unambiguous.
- No internals leak — AST node names and host exceptions never appear.
- One problem, one diagnostic — recovery prevents cascading noise.
- Codes are forever — once shipped, a code's meaning is frozen.
Code ranges
Every code is ZX plus four digits, reserved per subsystem:
| Range | Subsystem |
|---|---|
ZX0001–0099 | Lexer (characters, tokens, strings) |
ZX0100–0299 | Parser (grammar / structure) |
ZX0300–0399 | Semantic analysis & names |
ZX0400–0499 | Compiler |
ZX0500–0699 | Type system |
ZX0700–0899 | Runtime |
ZX0900–0999 | Classes (OOP) |
ZX1000–1099 | Standard library |
ZX1100–1199 | Web services |
ZX1200–1299 | Security |
ZX1300–1399 | Module system |
ZX1400–1499 | Package manager |
ZX1500–1599 | Testing framework |
ZX1600–1699 | Documentation generator |
ZX1700–1799 | Debugger |
ZX1900–1999 | Application entry point |
ZX2000–2099 | Structured concurrency |
ZX2100–2199 | Error recovery (try) |
ZX2200–2299 | Maps / dictionaries |
ZX2300–2399 | Async execution |
ZX2400–2499 | Data layer / ORM |
ZX2500–2599 | Enterprise application layer |
ZX2600–2699 | Configuration, secrets & environment |
ZX2700–2799 | Middleware & request pipeline |
ZX2800–2899 | Logging & observability |
ZX2900–2999 | Advanced authorization |
ZX3000–3099 | Background processing |
ZX3100–3199 | Advanced data / queries |
ZX3200–3299 | Messaging & event bus |
ZX3300–3399 | Enterprise hardening |
ZX3400–3499 | Remote package registry |
ZX3500–3599 | ORM migrations & schema evolution |
ZX3600–3699 | Native deployment & hosting |
ZX3700–3799 | Security analyzer (advisory rules ZX3701–3711) |
ZX3800–3899 | Memory safety & resource limits |
ZX3900–3999 | Profiling |
ZX4000–4099 | Static analysis (definite-assignment, reachability, type & relationship audit) |
A few in the catalog
| Code | Message |
|---|---|
ZX0002 | This text string is missing its closing quote ". |
ZX0103 | I expected 'end' to close this if block. |
ZX0104 | 'repeat' needs a count followed by 'times'. |
ZX0110 | 'function' is a reserved word and can't be used as a name. |
ZX0700 | I don't know what 'name' is — it was never created. |
ZX0706 | I can't divide by zero. |
ZX1205 | This value is untrusted and must be checked before it's combined with trusted text. |
ZX2504 | Validation failed — a record broke its rules. |
ZX3001 | There's no job named 'SendWelcome'. |
ZX0119 | This is nested too deeply to parse. |
ZX0957 | This property is read-only and can't be assigned. |
ZX0731 | There's no parameter named 'timeut' here. Did you mean 'timeout'? |
ZX1051 | This regular expression timed out — it backtracks too much on this input. |
ZX1316 | 'internal_helper' exists in module 'users' but isn't public. |
Machine-readable too
Every diagnostic also serializes to JSON (code, severity, message, file, range, help) for editor tooling and CI.