CISC 471/672 Programming Assignment #5 — MeggyJava local and member variables and assignmwent

Due Tuesday, December 15(by 11:59pm)

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

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

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.

(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:

Your joint and separate evaluations will be graded based on the following criteria:

Evaluation

This assignment is graded on a 100 point scale. Your submission will be graded with the following breakdown: This project is based on the project created by Michelle Strout in a course at Colorado State University.