Added while loop
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
|
||||
import de.hsrm.compiler.Klang.nodes.*;
|
||||
import de.hsrm.compiler.Klang.nodes.expressions.*;
|
||||
import de.hsrm.compiler.Klang.nodes.loops.whileLoop;
|
||||
import de.hsrm.compiler.Klang.nodes.statements.*;
|
||||
import de.hsrm.compiler.Klang.types.Type;
|
||||
|
||||
@@ -57,6 +58,14 @@ public class ContextAnalysis extends KlangBaseVisitor<Node> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node visitWhileLoop(KlangParser.WhileLoopContext ctx) {
|
||||
Node condition = this.visit(ctx.cond);
|
||||
Node block = this.visit(ctx.braced_block());
|
||||
return new whileLoop((Expression) condition, (Block) block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Node visitVariable_declaration(KlangParser.Variable_declarationContext ctx) {
|
||||
String name = ctx.IDENT().getText();
|
||||
|
||||
Reference in New Issue
Block a user