Expression Nodes
Literals (Lit)
Direct representation of values:
42 % Integer literal
3,14159 % Double literal
'A' % Character literal
true % Boolean literal
"Hello" % String literalVariables (Var)
Named storage locations:
x: int = 42
counter: int = 0
BUFFER_SIZE: int = 1760 % Constant declarationFunctions
Function declarations with type signatures:
% Basic function
main: never -> int = {
% Function body
}
% Function with parameters
process: int double -> never = value coefficient {
% Function body
}Declarations
Variable and constant declarations:
Assignment
Value assignment operations:
Function Calls (Call)
Invoking functions:
Conditional Expressions (If)
Branching logic:
Loops
While (loop)
Frost supports loop constructs for iteration:
From (range)
Iterating over a range of values, by step:
Block Expressions (Block)
Grouped statements:
Control Flow
Return
Frost supports implicit and explicit return statements. The ret keyword is used for explicit return.
The last expression in a function is implicitly returned, without the need for a ret statement.
Break and Continue
Frost supports break and continue statements for control flow:
Unary Expressions (Postfix)
Operations after the operand:
Unary Expressions (Prefix)
Operations before the operand:
Operators (Op)
Binary operations, including arithmetic, bitwise, and logical operators:
Structure Access (StructAccess)
Member access in structures:
Array Access
Array indexing:
Type Casting (Cast)
Explicit type conversions:
Remember that Frost's expression syntax is designed to be clear and unambiguous, with a focus on readability while maintaining low-level control when needed. The language uses a consistent style across different expression types to make code easier to understand and maintain.
Last updated