public override void WhileCondition() { //We have the result of evaluating the condition on the stack. //If the result was 0, we should jump to the end label; otherwise, //we continue with the loop body from here. Output.WriteLine(" if (__POP() == 0) goto {0};", _endWhileLabels.Push()); }
public override void BeginIf() { //We have the result of evaluating the condition on the stack. //If the result was 0, we should jump to the else label; otherwise, //we continue with the if statement body from here. Output.WriteLine(" if (__POP() == 0) goto {0};", _elseLabels.Push()); }
public override void PossibleElse() { Output.WriteLine(" goto {0};", _endIfLabels.Push()); Output.WriteLine("{0}:", _elseLabels.Pop()); }
public override void BeginWhile() { Output.WriteLine("{0}:", _beginWhileLabels.Push()); }