Testing your Code

Your parser and interpreter must detect errors and explicitly signal them by calling (error ...). An error raised internally by Scheme (and not by your use of the function error) is a bug in your code.

For example, Scheme signals a "divide by zero" error if you attempt to evaluate (/ 1 0). Since we use Scheme's division function to implement division in this assignment, you may be tempted to leave it to Scheme to signal division by zero errors for you. However, you must signal the error yourself by explicitly testing for division by zero before calling Scheme's division procedure.

If you are not sure if an error raised by your program constitutes a bug, search the DrScheme Help for test/exn. test/exn tests for errors, but only succeeds on errors that you explicitly signal. (NOTE: If you are using SchemeUnit, then you will want to use check-exn instead. If you are unclear on this, drop a note or ask a question.)