Example #1
0
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
Example #2
0
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
Example #3
0
def print_func(x, p):
    s = x.toString()
    print(s)
    new_expr = Expr(p)
    new_expr.const(0)
    return new_expr
Example #4
0
def neg_func(x, p):
    xv = x.val
    v = -xv
    new_expr = Expr(p)
    new_expr.const(v)
    return new_expr
Example #5
0
 def func(self, key: str, func: str, args: [str]):
     expr = Expr(self)
     expr.function(func, args)
     self.context.update({key: expr})
Example #6
0
 def symbol(self, key: str, symbol: str):
     expr = Expr(self)
     expr.symbol(symbol)
     self.context.update({key: expr})
Example #7
0
 def const(self, key: str, const: int):
     expr = Expr(self)
     expr.const(const)
     self.context.update({key: expr})