<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def eval_expr(expr_str, show_tokens=False, showast=False, showgrammar=False, compile_mode='exec'):
 """ evaluate simple expression """


    parser_debug = {'rules': False, 'transition': False,
                    'reduce': showgrammar,
                    'errorstack': True, 'context': True }
    parsed = parse_expr(expr_str, show_tokens=show_tokens,
                        parser_debug=parser_debug)
    if showast:
        print(parsed)

    assert parsed == 'expr', 'Should have parsed grammar start'

    evaluator = ExprEvaluator()

    # What we've been waiting for: Generate source from AST!
    return evaluator.traverse(parsed)