Reference
Specification
Behind the friendly surface is a strict, context-free grammar and a real type system. This page summarizes the formal foundation.
Design philosophy
Zornux optimizes for structural intuition over memorization, on three principles:
- Zero punctuation overhead. Statements read as English sentences.
- Flexible structural bounds. Blocks close with
end; whitespace is never significant. - Intent-aware diagnostics. Errors are explained in plain language with a suggested fix.
Lexical structure
- Source files are UTF-8 and use the
.zxextension. - Whitespace and newlines only separate tokens — indentation is cosmetic.
- Comments start with
#and run to end of line. - Identifiers start with a letter;
snake_casefor values and functions,PascalCasefor classes and services (by convention).
Type-system rules
Zornux is strongly typed with dynamic checking. The core rules:
- No implicit cross-kind coercion.
Number + Textis an error. +is overloaded for number addition and text concatenation — operands must match.- Comparisons order like-typed values — two numbers numerically, two texts by Unicode order, dates and times chronologically;
is equal toworks within a type and isfalseacross types. - Truthiness is explicit. Only a
Truthvalue may be a condition. nothingis its own type — not0,"", orfalse.UntrustedTextcan't be used as trusted text until validated — the language-level basis of the security model.
Grammar (EBNF excerpt)
A representative slice in ISO/IEC 14977 EBNF. The parser is the
authoritative grammar; this excerpt is illustrative and omits many
constructs (maps, sets, records, enums, contracts, properties,
switch, try/catch, and more).
program = { statement } ;
statement = create_statement | show_statement | if_statement
| repeat_statement | for_each_statement | while_statement
| function_declaration | give_back_statement ;
create_statement = "create" , identifier , ( "as" | "=" ) , expression ;
if_statement = "if" , expression , { statement } ,
{ "else" , "if" , expression , { statement } } ,
[ "else" , { statement } ] , "end" ;
repeat_statement = "repeat" , expression , "times" , { statement } , "end" ;
for_each_statement = "for" , "each" , identifier , "in" , expression ,
{ statement } , "end" ;
function_declaration = "function" , identifier , [ "with" , parameter_list ] ,
{ statement } , "end" ;
Expression precedence
From lowest binding to highest (verified from the parser ladder):
??— null-coalesce (right-associative)orand- comparisons — equality, relational, membership (
is in), and type (is an instance of); chainable, left-associative +-*/modulo(alias%)- prefix
-,not **— exponentiation (right-associative).()[]— member, call, index (postfix)- primary — literals, names, grouping
( )[ ]{ }
Prefix -/not bind looser than **, so -2 ** 2 is -(2 ** 2), and the right side of ** may be unary (2 ** -3).
Each release freezes its surface and grows only additively — a program valid in an earlier release stays valid. The frozen 1.8.0 surface is 89 keywords · 339 built-ins · 127 native APIs · 503 diagnostics. New features prefer contextual words (like get/set) over new reserved words, so they rarely collide with your names.
See the full word list in the Keywords reference, and error reporting in Diagnostics.