Add support for methods, constructors and destructors to your T compiler. This includes method arguments, method return values, method inheritance, method overriding and method overloading. With respect to constructors and destructors, you will need to implement the delete statement, default constructors and destructors, constructor overloading, and implicit superclass constructor invocation.
First, you should fix all bugs in your compiler with respect to Phases 1, 2 and 3. Testing (and grading) your Phase 4 submission will depend on the Phase 1, Phase 2 and Phase 3 functionality.
Upgrade your scanner to support the delete statement and the "this" and "super" keywords. I do not think there are any other changes you will need to make to your scanner, but I could be wrong. Think about it and, if further changes are needed, make them. (And please let me know.)
You will need to upgrade your parser to add the necessary productions and build AST nodes for method declarations, constructor declarations, destructor declarations, method invocations, constructor invocations, delete statements.
You will need to upgrade your semantic analysis routines to properly handle methods, constructors, destructors and the delete statement. Upgrade your handling of the pre-defined class Object to support its method, its constructor and its destructor. Be sure to detect the necessary semantic errors and issue appropriate messages to stderr.
Finally, you will need to upgrade your code generator to generate code for methods, constructors, destructors and the delete statement. Be sure to consider detecting run-time errors.
Your compiler should maintain all the behavior mandated by the Phase 1 specification, regarding command-line switches, AST dump format, Makefile goals, README file, etc.
Upgrade your handling of the command-line flag "-classes" in order to also dump the methods, constructors and destructors. It is up to you whether you dump the default constructors and destructors. It is also up to you whether you dump the inherited methods for a particular class, or only show the methods explicitly declared in the class.
Archive all your files in a tar file called "phase4.tar". This tar file should un-tar into a single directory called "phase4", which should contain the Makefile, the README file, the "RTS.cxx" file and all the source files. All submitted files should be placed directly in the top-level of this directory. (That is, please do not use subdirectories.) You should submit your tar archive from euler.unh.edu or zeno.unh.edu using my "submit" script. (The submission script will not work from gauss.unh.edu.) Please note: the tar file you submit should not be compressed. But, please, do not include any executable or object files in the tar file.
To turn in this assignment, type:
~cs712/bin/submit phase4 phase4.tar
Submissions can be checked by typing (also on euler.unh.edu or
zeno.unh.edu):
~cs712/bin/scheck phase4
Points will be assigned for this assignment in the following manner:
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday April 28. Late submissions will be accepted at a penalty of 2 points for one day late, 5 points for two days late, 10 points for three days late, 20 points for four days late, and 40 points for five days late. No program may be turned in more than 5 days late.
Remember: you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu