**********************************************************************
** Compilers - Spring Semester 2014 **
** Semester Project: MiniJava (subset of Java) compiler **
** Part 1 out of 4: Semantic Check **
**********************************************************************
Project assignment with more information on MiniJava can be found here.
This is the first out of four parts of the semester project for the Compilers course.
Input is MiniJava source files which are semantically checked, throughout three phases,
namely class names collection, class{Members, Methods} information collection,
and finally Type checking phase (described elaborately in the javadoc of Driver
class).
We were provided with the MiniJava grammar in JavaCC form and used JavaCC and JTB tools to generate
parser code, abstract syntax trees and visitors.
For traversing the AST (which represents a MiniJava program), the Visitor pattern is employed.
Run mvn package
.
File minijava-minijava-semantical-analyzer-VERSION.jar
will be created under target
directory.
The semantical analyzer expects Java source files as input (any number of Java files).
These, will be semantically checked one by one.
java [MainClassName] [file1] [file2] ... [fileN]
java -jar /path/to/jar/file/minijava-semantical-analyzer-1.0.jar [javaSrcFile1] .. [javaSrcFileN]
We were provided with some test files (located under src/test/resources/minijava-test-files
)
and created some of our own during development (the latter can be found under src/test/resources/minijava-dev-tests
).
To run all tests (from both directories), simply run tests.sh
.