Hello HellOfMice, John already explained that the very reason for the RPN existence is the elimination of parenthesis describing an arithmetic expression.

The parenthesis are replaced by **the stack order of values and the order of operations** inputted to the machine.

To define the **correct order**. starting from standard expressions style (algebraic) some analysis must be operated on the expression before to push operands on the stack and sequences the math operations. This is normally done by the person that punches values on the keyboard of a pocket calculator (HP) or write a Forth program. On other calculators, i.e. TI-59 programmable calculator,the conversion was made via software with its pioneering Algebraic Operating System (AOS) used to evaluate parenthesized arithmetic expressions.

At the bottom there is always an operands stack and a sequence of functions (operators) to compute the result.

All this to say that the RPN is just a way of representation of algebraic expression than a computation procedural method. It was appreciated in computing because it were well tailored to the stack/procedure structure of computers.

Now in case of a compiler that should be able to honor the operators priority you need the same approach used for common languages , that is analyze the expression and build the operands/operators sequence to correctly execute the computation.

In your case you seems to want keep the standard algebraic expression style, but you want to use a pseudo RPN abstarction in your virtual machine, so you need an interpreter that analyze the whole expression and manage the stack and procedures accordingly.

Please note that when you make a call to function that computes a result with 2 operands like:

` int a = add(5, 4);`

You are using, incidentally, the same approach of an RPN evaluation: the compiler pushes on the stack the 2 operands, then performs the procedure on them. The only difference is that the result is not automatically put on the TOS, but normally returned in a CPU register.