CS 6013 - Modern Compilers, Theory and Practice

Assignment 1: Properties of Variables (Uninitialized and Constants)

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

  1. Your homework will be graded for a total of 100 marks.
  2. You are expected to make two solutions: one manually, one using any llm/co-pilot.
  3. Weightage for manual version (80%), Weightage for the llm version (20%).
  4. Both the versions will be evaluated against the same set of testcases.

[ under development ]