Lexical Syntax

This section defines the lexical structure of AodhML — how source code is broken into tokens.

Whitespace

Whitespace (spaces, tabs, newlines) is significant only as a token separator. AodhML is not whitespace-sensitive — indentation is for readability only.

Comments

// Line comment — extends to end of line
/* Block comment — can span
   multiple lines */

Identifiers

Identifiers begin with a letter or underscore, followed by letters, digits, or underscores:

valid_ident
_valid
alsoValid123
Valid_Identifier

Keywords

KeywordPurpose
fnFunction declaration
letImmutable variable binding
mutMutable variable binding
typeType alias or definition
structStruct type
enumEnumeration type
traitTrait definition
implTrait implementation
importModule import
pubPublic visibility
returnReturn from function
if, elseConditional
for, inIteration
whileWhile loop
matchPattern matching
break, continueLoop control

Operators

OperatorDescriptionPrecedence
::Namespace / associated functionHighest
.Field accessHighest
[]IndexingHighest
()Function callHighest
!Logical NOTUnary
-NegationUnary
*, /, %Multiplication, division, moduloHigh
+, -Addition, subtractionMedium
@Matrix multiplicationMedium
==, !=EqualityLow
<, >, <=, >=ComparisonLow
&&Logical ANDLower
||Logical ORLowest
=AssignmentLowest

Literals

42          // i32 integer
42u64       // u64 integer
3.14        // f64 float
3.14f32     // f32 float
true        // bool
"hello"     // String
[1, 2, 3]   // Array literal
{ a: 1 }    // Struct literal