Expression Evaluator
This project is an expression parser and evaluator that takes standard infix arithmetic expressions and computes them while respecting operator precedence and parentheses. It’s built around a two-stack approach, allowing the expression to be evaluated step by step while also checking for invalid or malformed input along the way.
Project Phases
- Start by defining how expressions are structured and how they should be broken into tokens.
- Build a stack-based evaluation system that correctly handles operator precedence.
- Extend the system to support parentheses and nested expressions.
- Add validation to catch common errors like missing values, invalid operators, and mismatched parentheses.
- Introduce support for implicit multiplication and proper handling of negative numbers.
- Handle runtime errors such as division by zero.
Summary of Key Learnings
The evaluator processes expressions in linear time using a stack-based approach. Personally, it was quite nice to see how different data types can be applied to speed up, or make posisble, solving a certain problem. This is a main idea in ADEN but this was the first time I really saw that.
Reflections
Expression Evaluator Reflection