CSSE 404: Parser
For this milestone you will extend your software from the previous
milestone to parse MiniJava programs.
Your parser will take the name of a text file as an argument. The
program will parse the file according to the syntax. Your program will produce a parse tree and
identify whether the input is a correct MiniJava program.
At this point, your parser may assume that you get a valid MiniJava
program, however, if you want to implement some rudimentary error
checking or correction, that would be fine. We will eventually have a
separate assignment on error checking. Please update the symbol table
as appropriate.
Deliverables
The following properties of MiniJava are the most common
sources of problems:
- Class declarations and field declaration in MiniJava must not
have a privileged access modifier; they cannot be declared public,
private, or protected.
- MiniJava’s main class must have just a main method; it must not
have any other methods. All methods in MiniJava must be declared
public. The main method must not have a return statement; all other
methods must end with a return statement.
- The set of valid statement forms in MiniJava is much
smaller than Java’s. Verify that each statement in your samples
matches one of the six statement forms:
- variable declaration with initialization,
- block,
- if-then-else,
- while,
- print, or
- assignment.
Deliverables
By midnight on the milestone deadline, submit a zipped copy of the
following to the corresponding drop-box on Moodle.
- The output of your program for each input (well labeled so I can
match input to output)
- the source code for your program
Grading
Your grade will be based on the percentage of the full
set of sample input files that your program processes correctly.
For now, we will use the same examples as for the lexer.