I use the javacc framework to implement the parser, using this framework I implemented the grammar. I used the java tree builder which integrates with javacc, the input is the grammar file and it outputs a javacc grammar file with the necessary code to build an AST. I use the necessary visitor classes to pass through the AST and build the symbol table and do the type and declaration checking and simultaneously generate the intermediate representation. I output the generated representation to output.txt
Compile parser by using the command: javac *.java
To run the program use the command: java Main < InputFile In this case the input file is Factorial.java so the command would be: Java Main < Factorial.java
The program will run and output the file output.txt which shows the Intermediate representation generated by the translator.