A common way to express a mathematical expression is usually consisted by operators being placed between operands. For example:
f(x) = 2 * 5 + 3 - 2 * (8 / (4 / 2)) + (3 * 3)
This form of defining the expression is called Infix notation. As stated on wikpedia:
Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands – "infixed operators" – such as the plus sign in "2 + 2".
Another way of defining the expression is called Reverse Polish notation (or commonly Postfix notation) where every operator follows all its operands.
2 * 5 + 3 - 2 * (8 / (4 / 2)) + (3 * 3)
2 5 * 3 + 2 8 4 2 / / * - 3 3 * +
Notice that as long as every operator has a fix number of operands there's no need for parenthesis. Also it is more difficult to parse an Infix expression by computers than postfix. What I really like the most on Postfix notation is how nicely it fits the usage of Stack.
..and main.js which just handles the modules. All of these can of course be found on GitHub repository.
If you're not sure why exactly I use the not operator please check out my previous blog article explaining this topic.
Plunker and GitHub
Blog about my programming experiments, tests and so on.