Syntax¶
Accepted
Accepted for V1 syntax source-form ownership and cross-reference structure.
Catalyst syntax should be compact, readable, and low ceremony. It favors short keywords and left-to-right meaning over symbolic cleverness.
This folder records source spelling and grammar shape. When syntax has deeper semantic rules, this index links to the canonical semantic page instead of repeating the full design.
Source Encoding¶
Catalyst source files are UTF-8. Source spans remain byte-based so compiler diagnostics, tooling, and reflection metadata can point back into source text deterministically.
Syntax Topics¶
- Source Grammar
- Consolidated EBNF-style grammar map for V1 source syntax and expression grouping.
- Keywords
- Working keyword set and non-keyword policy.
- Naming Conventions
- Capitalization, prelude constructor names, resource names, contracts, enums, errors, and acronyms.
- Comments
- Regular comments, documentation comments, module docs, attachment, normalization, and tooling trivia.
- Literals
- Source spelling for numeric, code point, string, primitive value, and aggregate literal forms.
- Expected-Type Shorthand
- Leading-dot members and contextual aggregate literals completed from an expected type.
- Operators
- Operator spelling and precedence notes recorded so far.
- Declarations
- Statement shape,
var/const, binding patterns, and shadowing. - Destructuring
- Struct and array destructuring syntax.
- Move Expressions
- Explicit ownership-transfer expression spelling.
- Conditional Declarations
- Compile-time declaration guards and type-predicate narrowing.
- Defer
- Scope-exit cleanup syntax owned by control-flow semantics.
Cross-Reference¶
- Functions
- Function declarations, parameters, signatures, pointers, defaults, inference, and
main. - Attributes
- Attribute syntax, targets, providers, and diagnostics.
- Control Flow
- Blocks, conditionals, loops, divergence, and statement separation.
- Arrays, Slices, Ranges, and Indexing
[N]T,[]T, array literals, indexing, ranges, and slicing syntax.- Reference and Mutability
- Value, pointer, slice, mutability, and ownership semantics.