Supposing I want to write module to evaluate e simple string expression like "5+3"
, "(7*8/2)/6"
etc...
The process that I am thinking of is:
- Lexical analysis in order to convert the string to set of atoms (numbers and operation).
- Convert the set of atoms from infix to postfix
- Evaluate the postfix and output the final result
My question is about the errors that happens in each stage:
- In first stage I should handle undefined symbols or empty string and calling them lexical errors. Is that right? anything to add?
- In the second stage, having something like two consequence multiplications symbol (*) is a not valid thing. What is this error called?
- In the third stage, Division by zero is an example of an error. What are this kind of errors called?