Language rules¶
This page records the rules that define Arkoi’s behavior.
Naming¶
- Identifiers name functions, variables, and parameters.
- Type names are written with the
@prefix in source code. - Source files use the
.arkextension.
Typing¶
- Function parameters carry explicit type annotations.
- Variable declarations carry explicit type annotations.
- Function return types carry explicit type annotations.
- The primitive type set includes
@s32,@u32,@u64,@f32,@f64, and@bool.
Scope¶
- Each function introduces a new scope.
- Variables live within the block where they are declared.
- Parameters are available throughout the function body.
Control flow¶
ifstarts a conditional branch.else ifadds another conditional branch.elseprovides the fallback branch.whilerepeats its body while the condition remains true.returnends execution of the current function.
Expressions and operators¶
- Arithmetic uses
+,-,*, and/. - Comparisons use
<,<=,>,>=,==, and!=. - Boolean logic uses
&&and||. - Parentheses group expressions and control evaluation order.
Precedence¶
From highest to lowest, operator precedence follows this order:
- Parentheses
- Multiplication and division
- Addition and subtraction
- Comparison
- Equality
- Boolean
&& - Boolean
||
Conversion¶
Type conversion uses explicit casts when a value changes representation.
Style rules¶
- Use indentation to define blocks.
- Keep function bodies direct and readable.