The input (anything that the user types) will be an expression in the infix notation, which is human-readable. Consider this for example:
(1 + 1) * 2
However, this is not something that we can evaluate as it is, so we convert it into a postfix notation or reverse polish notation.
To convert an infix to a postfix notation is something that takes a little getting used to. What we have is a watered-down version of that algorithm in Wikipedia, as follows:
- Take the input expression (also known as, the infix expression) and tokenize it, that is, split it.
- Evaluate each token iteratively, as follows:
- Add the token to the output string (also known as the postfix notation) if the encountered ...