The Stop Statement
Stop provides an early exit from a loop or conditional block.
Example:
While (I < 10)
{
If (I == 5)
{
Stop;
}
I = I + 1;
}
The semantic analyzer currently enforces these rules:
Stopcannot be used insideMainStopmust be inside a loop orIfstatement
In the compiler, Stop is represented as Statement::Stop in src/ast.rs.
The semantic checks are implemented in src/semantic.rs.
Code generation is handled by FunctionCompiler::compile_statement in src/codegen.rs.
Stop is not an exception mechanism. It represents a structured early exit.