Spring 2005

Ileana Streinu

Lecture 12

- Evaluating arithmetic expressions. A special notation easily
understood by computers:
**Reverse Polish Notation**.- Fully parenthesized arithmetic expressions.
- Binary expression trees.
- Polish notation. Prefix, infix and postfix form.
- Evaluating arithmetic expressions in postfix form using a stack.
- Work out a few examples.
- Compare with the applet for matching parentheses.

- For next homework, you will implement the algorithm to convert an arithmetic expression to postfix form (and more).
- We'll see more about trees in a few weeks - and you will implement this data structure.

- Use of stacks for temporary memory allocation of parameters and local variables of functions, during function calls.
- More applications of stacks: memory allocation part I.
- How compilers treat global and local variables and function parameters.
- How the call of a function is evaluated using a stack. How the value returned by a function is stored on top of the system stack.

Ileana Streinu