Syntax reference
This section is the detailed syntax reference for the Draton language as it exists in the repository today. It is organized by syntax family instead of by feature marketing.
The goal is straightforward:
- document what the parser accepts
- distinguish canonical syntax from compatibility syntax
- keep examples aligned with the real Rust frontend
What this reference covers
The pages below cover the current surface area of the language:
- literals and values
- variable bindings and assignment
- functions, calls, lambdas, and generics
- expressions and operators
- control flow and pattern matching
- top-level items and modules
- types and
@typecontracts - classes, interfaces, enums, errors, and layers
- concurrency and channels
- low-level, compile-time, and runtime-special syntax
Canonical versus accepted
This reference uses two terms deliberately:
- canonical means the preferred language surface
- accepted means the parser still accepts it, often for migration compatibility
If a form is accepted but not canonical, the docs say so explicitly.
Recommended reading order
If you want the whole syntax with context: