@Override public void VisitIfNode(GtIfNode Node) { /*local*/ int ElseLabel = this.NewLabel(); /*local*/ int EndLabel = this.NewLabel(); Node.CondNode.Accept(this); this.VisitingBuilder.Append("JMPF " + "L" + ElseLabel + ", REG" + this.PopRegister() + "\n"); this.VisitBlock(Node.ThenNode); this.VisitingBuilder.Append("JMP " + "L" + EndLabel + "\n"); this.VisitingBuilder.Append("L" + ElseLabel + ":\n"); this.VisitBlock(Node.ElseNode); this.VisitingBuilder.Append("L" + EndLabel + ":\n"); }
@Override public void VisitWhileNode(GtWhileNode Node) { /*local*/ int CondLabel = this.NewLabel(); /*local*/ int EndLabel = this.NewLabel(); this.PushLoopLabel(CondLabel, EndLabel); this.VisitingBuilder.Append("L" + CondLabel + ":\n"); Node.CondNode.Accept(this); this.VisitingBuilder.Append("JMPF " + "L" + EndLabel + ", REG" + this.PopRegister() + "\n"); this.VisitBlock(Node.BodyNode); this.VisitingBuilder.Append("JMP " + "L" + CondLabel + "\n"); this.VisitingBuilder.Append("L" + EndLabel + ":\n"); this.PopLoopLabel(); }