예제 #1
0
 def evalToRegInstr(self, p, reg):
     if self.operator == '+':
         return Instructions.PLUS(p, self.left, self.right, reg)
     if self.operator == '-':
         return Instructions.MINUS(p, self.left, self.right, reg)
     if self.operator == '*':
         return Instructions.TIMES(p, self.left, self.right, reg)
     if self.operator == '/':
         return Instructions.DIVIDE(p, self.left, self.right, reg)
     if self.operator == '%':
         return Instructions.MODULO(p, self.left, self.right, reg)
     else:
         raise Exception("Operator '%s' not defined" % self.operator)