WhileNode class
Represents a while loop statement in Balbismo.
A while node implements iterative execution based on a condition. The loop body is executed repeatedly as long as the condition evaluates to non-zero (true). The condition is checked before each iteration, so the loop may execute zero or more times.
Example Balbismo code:
int i = 0;
while (i < 10) { // This is a WhileNode
printf("%d\n", i);
i = i + 1;
}
This generates LLVM IR with a loop structure:
br label %while.0
while.0:
; evaluate condition
%conditionCast.0 = icmp ne i64 %i, 0
br i1 %conditionCast.0, label %block.0, label %end.0
block.0:
; loop body code
br label %while.0
end.0:
Constructors
-
WhileNode.new(Node<
dynamic, LangVal< condition, BlockNode block)LangType> > - Constructs a while loop with condition and body block.
Properties
- block → BlockNode
-
no setter
-
children
→ List<
Node> -
Child nodes that form the structure of this node.
finalinherited
-
condition
→ Node<
dynamic, LangVal< LangType> > -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ int
-
Unique identifier for this node, used for LLVM register naming.
getter/setter pairinherited
- nodeValue → void
-
The primary value associated with this node (varies by node type).
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
evaluate(
SymbolTable table) → void -
Evaluates this AST node and generates corresponding LLVM IR code.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited