예제 #1
0
 def checkOpStack(self):
     if self.currOpStackSize != 0:
         raise IllegalRuntimeException("Stack not empty")
예제 #2
0
 def getBreakLabel(self):
     if not self.brkLabel:
         raise IllegalRuntimeException("None break label")
     return self.brkLabel[-1]
예제 #3
0
 def pop(self):
     self.currOpStackSize = self.currOpStackSize - 1
     if self.currOpStackSize < 0:
         raise IllegalRuntimeException("Pop empty stack")
예제 #4
0
 def getContinueLabel(self):
     if not self.conLabel:
         raise IllegalRuntimeException("None continue label")
     return self.conLabel[-1]
예제 #5
0
 def exitLoop(self):
     if not self.conLabel or not self.brkLabel:
         raise IllegalRuntimeException("Error when exit loop")
     self.conLabel.pop()
     self.brkLabel.pop()
예제 #6
0
 def getEndLabel(self):
     if not self.endLabel:
         raise IllegalRuntimeException("None end label")
     return self.endLabel[-1]
예제 #7
0
 def getStartLabel(self):
     if not self.startLabel:
         raise IllegalRuntimeException("None start label")
     return self.startLabel[-1]
예제 #8
0
 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()