Docs/language reference
LANGUAGE REFERENCE

The language, clearly.

The exact types, binding rules, and operators implemented in the alpha.

Source files.

Use .chud or .CHUD. Source is UTF-8, with an optional BOM. Keywords are case sensitive. Identifiers use ASCII letters, digits, and underscores, starting with a letter or underscore. Comments use // or non-nested /* … */.

Four types to start with.

TypeAlpha behavior
intSigned 32-bit integer, −2,147,483,648 through 2,147,483,647.
booltrue or false; no implicit numeric conversions.
stringImmutable UTF-8 literals in process-lifetime static storage.
voidFunction return type only; cannot be stored or printed.

Other primitive types are not implemented yet. Static string equality compares byte contents. There is no string concatenation, indexing, or dynamic string allocation in this alpha.

Say what can change.

CHUD
let name = "CHUD";
mut count: int = 0;
const MAX_USERS = 100;

count += 1;

let creates an immutable local; mut permits assignment. Types are inferred from an initializer unless explicitly annotated. An annotation must match exactly. const currently accepts literal values, including a negated integer.

Initializers are required. Nested scopes may shadow an outer name; duplicate bindings in one scope are errors. Compound assignment supports +=, -=, *=, and /= on mutable integer bindings.

Predictable operators.

Precedence, tightest firstOperators
Unary- !
Multiplication* / %
Addition+ -
Ordering< <= > >=
Equality== !=
Logical AND&&
Logical OR||

Binary operators associate left. Logical AND and OR short circuit. Function arguments evaluate left to right. Integer addition, subtraction, multiplication, and negation wrap modulo 2³². Division truncates toward zero.

Strings and escapes.

CHUD
CHUD.Print("Hello, CHUD!");
CHUD.Print("Line one\nLine two");
CHUD.Print("CHUD" == "CHUD");

Supported escapes are \n, \r, \t, \", and \\. Raw line breaks and NUL are rejected inside string literals.

Know the boundaries.

Structs, reference types, traits, generics, Result, collections, nullability, async, and unsafe operations are not implemented. They remain language design targets.

Covers the implemented 0.1.0-alpha subset · Windows x64

Search language syntax, setup, Studio, and more.

CHUD DOCUMENTATION↑ ↓ to navigate · Enter to open