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)
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)
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)
def division(self, ast): return pi.Div(ast.left, ast.right)