Csc 4330/6330, Programming Language Concepts (Summer 2020)
Error Reporting
You will write two functions in the main program: evalNum(tree) and evalList(tree) that take as input parameter the data structure corresponding to a LISP expression or a LIST expression respectively and return the value of the expression.In order to catch and report run-time errors such as "divide by 0", "variable not instantiated", "CAR of empty list", or "CDR of empty list", it will be convenient for the return value of these two functions to be a pair: (value,errorString).
In case there is no error while evaluating the expression, (value,"OK") may be returned and in the case of a run-time error, the return value could be (0,"CAR of empty list"), for example.