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 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 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 func(self, key: str, func: str, args: [str]): expr = Expr(self) expr.function(func, args) self.context.update({key: expr})
def symbol(self, key: str, symbol: str): expr = Expr(self) expr.symbol(symbol) self.context.update({key: expr})
def const(self, key: str, const: int): expr = Expr(self) expr.const(const) self.context.update({key: expr})