def checkOpStack(self): if self.currOpStackSize != 0: raise IllegalRuntimeException("Stack not empty")
def getBreakLabel(self): if not self.brkLabel: raise IllegalRuntimeException("None break label") return self.brkLabel[-1]
def pop(self): self.currOpStackSize = self.currOpStackSize - 1 if self.currOpStackSize < 0: raise IllegalRuntimeException("Pop empty stack")
def getContinueLabel(self): if not self.conLabel: raise IllegalRuntimeException("None continue label") return self.conLabel[-1]
def exitLoop(self): if not self.conLabel or not self.brkLabel: raise IllegalRuntimeException("Error when exit loop") self.conLabel.pop() self.brkLabel.pop()
def getEndLabel(self): if not self.endLabel: raise IllegalRuntimeException("None end label") return self.endLabel[-1]
def getStartLabel(self): if not self.startLabel: raise IllegalRuntimeException("None start label") return self.startLabel[-1]
def exitScope(self): if not self.startLabel or not self.endLabel or not self.indexLocal: raise IllegalRuntimeException("Error when exit scope") self.startLabel.pop() self.endLabel.pop() self.currIndex = self.indexLocal.pop()