As I did many years ago, a new operator was invented for my postfix expression. Therefore, when I came across a unary minus in the infix, I would convert it to # . So my postfix for a + -b became ab#+ .
And, of course, my evaluator should have known that # only pops one operand.
The view depends on how you use the postfix expression after creating it. If you want to display it, your special # operator probably confuses people. But if you just use it inside (I was), then it works great.
Jim mischel
source share