Add support for methods, constructors and destructors to your compiler for the T programming language. 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. The test files used for grading Phase 3 will be available in ~cs712/public/tests/phase3/grading after the final date to submit Phase 3 has passed.
Upgrade your scanner to support the delete statement and the "this" and "super" keywords.
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. See the file ~cs712/public/phase4.y for the productions of the T grammar that you need to add for this phase.
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. See the file ~cs712/public/phase4.intel for the code generation patterns for this phase.
Your compiler should maintain all the behavior mandated by the Phase 1-3 specifications, 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.
As in earlier phases, archive all your files in a tar file called "src.tar". This tar file should un-tar into a single directory called "src", which should contain the Makefile, the README file, the "RTS.c" 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 agate.cs.unh.edu using my "submit" script. 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 src.tar
Submissions can be checked by typing (also on agate.cs.unh.edu):
~cs712/bin/scheck phase4
Points will be assigned for this assignment in the following manner:
The assignment is due on Sunday May 5. There is a grace period to 8am on Monday May 6 when no late penalty will be assigned. Submissions between 8am May 6 and 8am May 7 will have a late penalty of 15 points. Submissions between 8am May 7 and 8am May 8 will have a late penalty of 30 points. No program may be turned in after 8am on Wednesday May 8.
Remember: you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu