Submit: Turn in your entire Project3 directory (JavaCC grammar, abstract syntax tree classes, associated helper classes, and Makefile using the turnin command on morbius.mscsnet.mu.edu or one of the other Systems Lab machines.
Work may be completed in teams of up to three students. Be certain to include all team members' names in the file. Include a comment block at the very top of each file that contains the following:
/**
* COSC 4400 - Project 3
* Explain briefly the functionality of the program.
* @authors [your names]
* Instructor [your instructor]
* TA-BOT:MAILTO [your email addresses]
*/
Implement a Parser for our dialect of the MiniJava programming language, as detailed below.
The Parser should take a MiniJava program from System.in and write the abstract syntax trees to System.out To capture the output to file, use the UNIX redirect operator:
make; java Parser.Main < program.java > program.ast
Our language will consist of:
The grammar will need to be modified to eliminate left recursion, enforce proper Java operator precedence and associativity, and to eliminate parsing conflicts. The grammar as given also accepts various non-sensical constructs, like having a Boolean expression on the left hand side of an assignment statement, which you may eliminate in your parser.
You must build and output an Abstract Syntax Tree. The JavaDoc description of the AST classes is here.
Other useful links:
[Revised 2020 Sep 28 21:39 DWB]