This assignment is the first part of a multi part project to write an optimizing compiler for BuritoJava.
We start with programs in BuritoJava syntax, where (i) all the variables are declared appropriately, (ii) there are no type errors, and our goal is to check if there are uninitialized variables, or if there are explicit assignments to final variables.
Use JTB and JavaCC and write in Java one or more visitors which check BuritoJava programs for assigning to final variables and uninitialized variables. Your main file should be called P1.java, if P.java contains a program to be checked then
java P2 < P.java
should printer either "No issue with variables.", or "Final variable being assigned.", or "Uninitialized variable found."
Note, your program must take input from standard input and write to standard output (so that we can use redirection).
To check that a program is in BuritoJava form, you could tie the BuritoJava.jj and Main.java to build a parser.
A sample Main.java can be found here.
Grading policy