Language Reference
A denser reference for the surface syntax, value model, and the rules that make examples readable.
Surface syntax
The lexer prefers the longest valid token and keeps the punctuation model intentionally small.
Comments, keywords, identifiers, literals, and delimiters are the only things the lexer needs to classify. The rest of the language is built from expression and pattern forms, which keeps the surface consistent even when the semantics underneath are rich.
- Semicolons are optional when a newline already ends a complete expression.
///comments are documentation comments and should read like the rest of the prose.::is for paths;.is for values.- The precedence table follows the familiar Rust and C shape so the page does not need to fight reader instinct.
Value model
La3 keeps the same basic split the rest of the docs rely on: scalars, compound values, and owned heap structures.
- Primitive values include booleans, exact-width integers, floats, characters, strings,
nil, unit, and never. - Compound values include tuples, arrays, slices, lists, maps, sets, structs, enums, and references.
- Some values are immediate and copyable; others are move-only because they own heap storage.
Absence and unions
The absence story is intentionally narrow so it stays easy to reason about.
nil is the single absence value. Option<T> is its explicit enum wrapper. T | nil is the light-weight local spelling. The two presentations exist for readability, not because the language has two different notions of nothingness.
??supplies a default when the left side is absent.?.reads a field or method only if the receiver is present.- Unions require narrowing before the compiler lets you treat the value as one member type.
Functions and flow
Functions, closures, if, match, and loops all behave like values where it helps the reader.
- The last expression in a block becomes the return value.
matchis exhaustive and is the preferred way to branch on enum shape.?is a propagation operator, not a control-flow magic trick.loop { break value }is the clean way to say "keep trying until you have a result."
Memory and ownership
The reader-facing memory model is one of the language's main selling points, so the docs should say it plainly.
- Safe references obey aliasing-xor-mutability.
- Raw pointers exist for low-level code and are wrapped in
unsafe. - Moves, borrows, and drops are compile-time concepts that let the runtime stay deterministic.
- Ownership is part of the syntax story because it changes what values a page can move around without copying.