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