Exemplo n.º 1
0
 def bin_exp(self, ast):
     if ast.op == "+":
         if isinstance(ast.e1, pi.Array):
             return pi.Append(ast.e1, ast.e2)
         return pi.Sum(ast.e1, ast.e2)
     elif ast.op == "-":
         return pi.Sub(ast.e1, ast.e2)
     elif ast.op == "*":
         return pi.Mul(ast.e1, ast.e2)
     elif ast.op == "/":
         return pi.Div(ast.e1, ast.e2)
     elif ast.op == "and":
         return pi.And(ast.e1, ast.e2)
     elif ast.op == "or":
         return pi.Or(ast.e1, ast.e2)
     elif ast.op == "<":
         return pi.Lt(ast.e1, ast.e2)
     elif ast.op == "<=":
         return pi.Le(ast.e1, ast.e2)
     elif ast.op == ">":
         return pi.Gt(ast.e1, ast.e2)
     elif ast.op == ">=":
         return pi.Ge(ast.e1, ast.e2)
     elif ast.op == "==":
         return pi.Eq(ast.e1, ast.e2)
Exemplo n.º 2
0
 def bin_exp(self, ast):
     if ast.op == "+":
         return pi.Sum(ast.e1, ast.e2)
     elif ast.op == "-":
         return pi.Sub(ast.e1, ast.e2)
     elif ast.op == "*":
         return pi.Mul(ast.e1, ast.e2)
     elif ast.op == "/":
         return pi.Div(ast.e1, ast.e2)
     elif ast.op == "and":
         return pi.And(ast.e1, ast.e2)
     elif ast.op == "or":
         return pi.Or(ast.e1, ast.e2)
     elif ast.op == "<":
         return pi.Lt(ast.e1, ast.e2)
     elif ast.op == "<=":
         return pi.Le(ast.e1, ast.e2)
     elif ast.op == ">":
         return pi.Gt(ast.e1, ast.e2)
     elif ast.op == ">=":
         return pi.Ge(ast.e1, ast.e2)
     elif ast.op == "==":
         return pi.Eq(ast.e1, ast.e2)
     ### Array Implementation ###
     elif ast.op == "\+":
         return pi.ArrayConcat(ast.e1, ast.e2)
Exemplo n.º 3
0
 def bin_exp(self, ast):
     if ast.op == "+":
         return pi.Sum(ast.e1, ast.e2)
     elif ast.op == "<<":
         return pi.Concat(ast.e1, ast.e2)
     elif ast.op == "-":
         return pi.Sub(ast.e1, ast.e2)
     elif ast.op == "*":
         return pi.Mul(ast.e1, ast.e2)
     elif ast.op == "/":
         return pi.Div(ast.e1, ast.e2)
     elif ast.op == "and":
         return pi.And(ast.e1, ast.e2)
     elif ast.op == "or":
         return pi.Or(ast.e1, ast.e2)
     elif ast.op == "<":
         return pi.Lt(ast.e1, ast.e2)
     elif ast.op == "<=":
         return pi.Le(ast.e1, ast.e2)
     elif ast.op == ">":
         return pi.Gt(ast.e1, ast.e2)
     elif ast.op == ">=":
         return pi.Ge(ast.e1, ast.e2)
     elif ast.op == "==":
         return pi.Eq(ast.e1, ast.e2)
Exemplo n.º 4
0
 def equality(self, ast):
     return pi.Eq(ast.left, ast.right)