Design of a simple compiler for a simplified Java language using ANTLR v4.10.1. Part of a project during my semester abroad the spring of 2022 at INSA Toulouse, France.
Display of the testing of the two test-files attached. With the code, output and generated parsetree.
public static void main(String[] args){
int a,b,c = 0;
b=1;
c=2;
int d = (c*c)+(c*b);
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
}
Output alongside given assembly code
ParseTree generated after running main
public static void main(String[] args){
int a_1, b_2, c_3 = 0;
a_1 = 10.5;
b_2 = 20;
c_3 = 15;
if ( a_1 < b_2){
System.out.println(c_3);
}
else {
System.out.println(b_2);
}
System.out.println(a_1);
}
Output alongside given assembly code
Output 1 - Output with code equal to displayed over
Output 2 - Output when '<' is switched in code to ensure if/else works as supposed
if ( a_1 > b_2)
ParseTree generated after running main