Mini Java is a subset of Java. The meaning of a MiniJava program is given by its meaning as a Java program, Overloading is not allowed in MiniJava. The MiniJava statement System.out.println( … ); can only print integers. The MiniJava expression e.length only applies to expressions of type int .
So we have to build a compiler witch can understand MiniJava programs.
Compiler building have to be divided into sequential steps :
o Lexical Analysis.
o Building abstract syntax tree (AST).
o Symantec Analysis.
o Code generation.
In this time we are going to do first three steps, and off course we are going to use some tools to help us in our work ( Javacc, Jjtree ) .
The first one “Javacc” or “Java compiler compiler “, Helps me to build my parser easily.
“Javacc” is LL(k) parser.
The second one “Jjtree” Helps me to build my abstract syntax tree (AST)