Assignment 3 - Bonus

Ryerson University

Error Management

Due: December 18



This bonus part contains two parts that can be done in any order. The runtime errors are implemented in the eval visitor and the parsing errors are implemented in HL.jjt.

Runtime errors

Add code to your interpreter to detect and report run-time errors. The errors that need to be detected will be specified in the test files.

Parsing errors

  1. Define 2 error recovery productions to use inside your parser productions:
        // ErrorReplace production called when string  was interpreted as  string.
        void ErrorReplace(String parsed, String expected) throws ParseAbortException
        // ErrorMissing production called when the token  was missing
        void ErrorMissing(String skipped) throws ParseAbortException
    and one error recovery method to be used in catch clauses:
        // ErrorSkipto called to consume all tokens up to the first one of kind 
        // The error message in  is also printed.
        void ErrorSkipto(int stoptoken, Error e) throws ParseAbortException
        void ErrorSkipto(int stoptoken, Exception e) throws ParseAbortException
    (The 2 separate definitions are needed to handle lexical errors which are errors and parse errors which are exceptions).

  2. As explained in JavaCC [tm]: Error Reporting and Recovery,


Supporting Files

Testing information

Here are the steps we will take to test and grade your assignment:

How to submit the bonus part of assignment 3

This page is maintained by Sophie Quigley (cps710@scs.ryerson.ca)
Last modified Saturday, 17-Dec-2016 00:41:02 EST