repeatuntil works

This commit is contained in:
simonkellet 2022-10-10 13:39:00 +01:00
parent c9ca3c5bba
commit 693d933c19
3 changed files with 8 additions and 0 deletions

View File

@ -185,6 +185,10 @@ public final class Encoder implements ActualParameterVisitor<Frame, Integer>,
@Override
public Void visitRepeatCommand(RepeatCommand ast, Frame frame) {
var loopAddr = emitter.getNextInstrAddr();
ast.E.visit(this, frame);
ast.C.visit(this, frame);
emitter.emit(OpCode.JUMPIF, Machine.trueRep, Register.CB, loopAddr);
return null;
}

View File

@ -188,6 +188,10 @@ public final class Checker implements ActualParameterVisitor<FormalParameter, Vo
@Override
public Void visitRepeatCommand(RepeatCommand ast, Void arg) {
var eType = ast.E.visit(this);
checkAndReportError(eType.equals(StdEnvironment.booleanType), "Boolean expression expected here", ast.E);
ast.C.visit(this);
return null;
}

Binary file not shown.