In Reverse Polish Notation, each operator follows its operands.
An infix expression like:
(1 + 2) * (4 - 5)
Is entered like:
1 2 + 4 5 - *
- Base use:
$ rpc 5 5 + 10 2 - *
$ Result: 80
$ rpc 5 5 + 0 /
$ Error: attempt to divide by 0.
$ rcp 123 123 \* 123 - 444 / # need to use \* to escape character
$ Result: 33
- Using the show steps flag (-s):
$ rpc -s 5 5 + 10 2 - *
$ rpc: 5 5 + 10 2 - *
$ rpc: 10 8 *
$ rpc: 80
- Literally do the minimum.
- Add optional flags.
- Show steps flag.
- Support floating-point numbers