def add_func(x, y, p): xv = x.val yv = y.val v = xv + yv new_expr = Expr(p) new_expr.const(v) return new_expr
def mul_func(x, y, p): xv = x.val yv = y.val v = xv * yv new_expr = Expr(p) new_expr.const(v) return new_expr
def print_func(x, p): s = x.toString() print(s) new_expr = Expr(p) new_expr.const(0) return new_expr
def neg_func(x, p): xv = x.val v = -xv new_expr = Expr(p) new_expr.const(v) return new_expr
def const(self, key: str, const: int): expr = Expr(self) expr.const(const) self.context.update({key: expr})