Several errors could occur when calling the add_token() function. Each of these errors need to be tested. These errors are:
Expected Operand – Occurs if the token contains a binary operator when the state of the Translator is Operand indicating an operand or a unary operator was expected.
Expected Operator – Occurs if the token contains an operand when the state of the Translator is Operator indicating an operator was expected.
Expected Binary Operator – Occurs if the token contains a unary operator that cannot be a binary operator when the state of the Translator is Operator indicating a binary operator was expected.
During development of the Translator, several other diagnostic errors can occur. These errors are the result of checks put into the code to verify that the Translator is working correctly, in other words, to report on situations that should not occur. These checks will be removed once the code is debugged and tested. These errors are:
Not Yet Implemented – Occurs when part of the code is reached that has not yet been implemented, for example this is returned if a token contains a parenthesis.
Stack Empty – Occurs at end of line processing if the Null token is not at the bottom of the hold stack.
Stack Not Empty – Occurs at end of line processing if the token on top of the hold stack is not the Null token.
Stack Empty 1 – Occurs if the done stack is empty when popping the first operand of an operator.
Stack Empty 2 – Occurs if the done stack is empty when popping the second operand of an operator.
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)