CISC 471/672 Programming Assignment #5 — MeggyJava local and member variables and assignmwent
Introduction
This assignment can be done with your programming partner. For PA4, PA5, and PA6 joint and separate partner reports are required if you are working with a partner (see below for details). The joint report should be put in the README file and the separate reports should be uploaded to sakai. Both are due with the assignment itself. The partner joint and separate reports will be worth 10% of the programming assignment grade for those of you working with a partner.In this assignment, you will be writing a compiler for the PA5 subset of the MeggyJava language that includes local and member variable declarations and assignment statements. The main addition in terms of functionality will be handling of classes, local and member variables, and the equality operator for references. Variable declarations of type button, and hence assignments to button variables, are not supported in MeggyJava.
You will
- add the PA5 grammar rules to the parser,
- and update the visitors to handle the new language features.
You will need to extend the type checking for objects and (instance and local) variables. Here are some example programs here.
The Assignment
Your Makefile from PA4 creates a jar file, MJ.jar, that can be executed as follows:java -jar MJ.jar InputFile.java
The input files can be any PA5 MeggyJava program. Start with the above simple examples. Ultimately, the PA5 test cases you wrote for PA1 and PA5PaddleBall.java are possible test cases for MJ.jar. The output file named InputFile.java.s should be an AVR assembly program that using the provided build process will run on the MeggyJr device. Additionally, the InputFile.java.s file must be such that we can run it through the AVR simulator.
Errors found while type checking and building the symbol table
Your compiler should produce error messages for doubly defined symbols, e.g. for PA5dupnameserror.java:[23,16] Redefined symbol A [27,17] Redefined symbol run [40,16] Redefined symbol B [45,17] Redefined symbol foo [51,21] Redefined symbol run [57,7] Redefined symbol A Errors found while building symbol table
Code Generation
Your build symbol table visitor now annotates the instance and local variables in the symbol table with offset and base information. This information is used by the AVR code generator to handle the new language features.Design, implement, and test the symbol table and related classes step wise.
Submitting the Assignment
- Make sure you test your implementation thoroughly. You can use the reference compiler in MJ.jar to compare against and to view sample outputs.
- Only turn in one assignment per group.
- Create the MJ.tar file that contains all the source code, two working test
cases that you wrote, two test cases with type errors that you wrote, your .cup
and .lex files, and a README file.
- The README file should include your usernames, email addresses, group name, a description of what you are testing in the test cases you are submitting, and any information you want the TA to have before grading your assignment. The README file should also include the joint partner report if you are working with a partner (see below for details).
- Submit assignment by committing and pushing all files and PA5.tar to github before the deadline.
Extra Credit
Your team can gain another 10% added to your total projects earned grade (which is makes up 50% of your grade) by implementing inheritance and demonstrating that your compiler accepts MeggyJava programs with inheritance, handles member variable accesses and method calls correctly when there is inheritance with classes that have overriding of methods. You can assume that the member variables are not overridden by subclasses. You must show test cases that demonstrate various cases: (1) class with subclasses and member variables in each class, (2) class with subclasses with methods in both classes, but no overriding of method names, and (3) class with subclasses with methods in both classes, and method overriding (methods with same name in both classes). Here is the only change to the grammar of MeggyJava to implement inheritance.ClassDeclaration ::= "class" Identifier ( "extends" Identifier )? "{" ( VarDeclaration )* ( MethodDeclaration )* "}"
Report and Evaluation of Partner Work
The partner joint and separate reports will be worth 10% of the programming assignment grade for those of you working with a partner.(joint) For each of PA4 through PA6, write a planning paragraph and timeline together and submit with your assignment.
- Who is going to do what? The plan and the reality.
- How is the testing going to be done? What actually happened.
- Timeline for finishing portions of assignment.
- Meeting schedule.
(separate) Submit on sakai for each of PA4 through PA6 an assessment of the partner work by the deadline of the assignment. The assessment should be approximately 1/2 a page with information about the following:
- What are some organizational strategies that you and your partner are using that are working well?
- Specifically how did you and your partner divide the work? (e.g., I wrote the type checker for the following set of grammar rules...).
- How could the division of work between the partners be improved?
- How could the interaction between the partners be improved?
Your joint and separate evaluations will be graded based on the following criteria:
- Have all of the relevant questions been addressed in a thoughtful manner.
- How well do the reports match in terms of the partners both understanding who is doing what.
- Clarity and succinctness of the writing.
- There will be a subjective evaluation of how well the partners attempted to make the group programming experience work.