def METHOD_NAME(eval_term, expr ):
    if expr.tag == "T": return eval_term(expr.childs[0]) #eval the terminals
    if expr.tag == "F":
        f = expr.childs[0].get_terminal()[1]
        return f (*[METHOD_NAME(eval_term, e) for e in expr.childs[1:]] )
    # Binary operations:
    ops = { "+": lambda x, y: x + y, "-": lambda x, y: x - y, "*": lambda x, y: x * y, "/": lambda x, y: x / y }
    return ops[expr.tag] (*[METHOD_NAME(eval_term, e) for e in expr.childs] )