As suggested in the lecture notes, write a function that can parse an arithmetic expression in postfix notation and return an expression tree.
Extend the infix expression parser from the lecture so that an expression can contain variables, where every variable name is a lowercase letter. For example, here is one possible expression:
((2 + x) * (y – 7))
Also extend the eval() function so that it can evaluate an expression with variables, given a dictionary that maps each variable name to its value.
Extending the previous exercise, write a function simplify() that takes an expression tree and simplifies it by making the following replacements:
E + 0 => E
0 + E => E
E * 0 => 0
0 * E => 0
E * 1 => E
1 * E => E
For example, simplifying the expression '((x * 1) – (y * 0))' will yield the expression 'x'.