Question regarding RPN and error detection
My task is too write a tree-based calculator program using RPN, that reads input from a file with commands delimited by ";".
I have done my data-flow charts, and tree diagram
Two potential issues occured to me, and after a few hours reading havent been able to resolve:
1 - [Resolved]
The following was provided as an example line of input in the file:
Code:
Sin(2pi*4.8)+exp(-pi)
In order for me to use RPN on this task, doesn't the input have to be in RPN, something like:
Code:
2 pi 4.8 pi * * + exp
*
2 - [Resolved]
When error checking, while I have implemented an input validation, that can check for the right operators, numbers, and correct number of parentheses. Should I check for "Undefined" mathematical functions? Like 0/1. Or should I let them pass, and return undefined as an evaluation of the answer.
Would appreciate any form of advice.
*Or similar, not totally familiar with the RPN notation
Edit: Question answered by Salem