diff --git a/CompilerFinalProject-main.iml b/CompilerFinalProject-main.iml
new file mode 100644
index 0000000..217fe69
--- /dev/null
+++ b/CompilerFinalProject-main.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/grammar/MiniJava.g4 b/grammar/MiniJava.g4
index 17c7cb2..320170b 100644
--- a/grammar/MiniJava.g4
+++ b/grammar/MiniJava.g4
@@ -11,7 +11,7 @@ mainMethod:
'public' 'static' 'void' 'main' '(' type Identifier ')' '{' statement* '}'
;
classDeclaration
-: 'class' className = Identifier ('inherits' parentName = Identifier)? ( 'implements' Identifier ( ',' Identifier)* )? '{' fieldDeclaration* methodDeclaration* '}';
+: 'class' className = Identifier (inherits = 'inherits' parentName = Identifier)? ( implements = 'implements' Identifier ( ',' Identifier)* )? '{' fieldDeclaration* methodDeclaration* '}';
interfaceDeclaration: 'interface' Identifier '{' fieldDeclaration* interfaceMethodDeclaration* '}';
@@ -19,7 +19,7 @@ interfaceMethodDeclaration
: (accessModifier)? returnType Identifier '(' parameterList? ')' ';';
fieldDeclaration
-: (accessModifier)? (Final)? type Identifier (EQ expression)?';'
+: (accessModifier)? (final = Final)? type Identifier (EQ expression)?';'
;
localDeclaration
: type Identifier ';';
diff --git a/out/production/CompilerFinalProject-main/compiler/Compiler.class b/out/production/CompilerFinalProject-main/compiler/Compiler.class
new file mode 100644
index 0000000..35fbfd6
Binary files /dev/null and b/out/production/CompilerFinalProject-main/compiler/Compiler.class differ
diff --git a/out/production/CompilerFinalProject-main/compiler/ProgramPrinter.class b/out/production/CompilerFinalProject-main/compiler/ProgramPrinter.class
new file mode 100644
index 0000000..ba2916b
Binary files /dev/null and b/out/production/CompilerFinalProject-main/compiler/ProgramPrinter.class differ
diff --git a/out/production/CompilerFinalProject-main/compiler/SymbolTable.class b/out/production/CompilerFinalProject-main/compiler/SymbolTable.class
new file mode 100644
index 0000000..043a9cd
Binary files /dev/null and b/out/production/CompilerFinalProject-main/compiler/SymbolTable.class differ
diff --git a/out/production/CompilerFinalProject-main/compiler/SymbolTableEntry.class b/out/production/CompilerFinalProject-main/compiler/SymbolTableEntry.class
new file mode 100644
index 0000000..8e36410
Binary files /dev/null and b/out/production/CompilerFinalProject-main/compiler/SymbolTableEntry.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJava.interp b/out/production/CompilerFinalProject-main/gen/MiniJava.interp
new file mode 100644
index 0000000..929ed79
--- /dev/null
+++ b/out/production/CompilerFinalProject-main/gen/MiniJava.interp
@@ -0,0 +1,124 @@
+token literal names:
+null
+'class'
+'{'
+'}'
+'public'
+'static'
+'void'
+'main'
+'inherits'
+'implements'
+','
+'interface'
+';'
+'boolean'
+'number'
+'private'
+'if'
+'else'
+'while'
+'print'
+'.'
+'new'
+'this'
+'&&'
+'<'
+'+'
+'-'
+'*'
+'**'
+'<>'
+'['
+']'
+'.length'
+'('
+')'
+'ret'
+'='
+'final'
+null
+null
+'null'
+null
+null
+'@Override'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+AND
+LT
+PLUS
+MINUS
+TIMES
+POWER
+NOT
+LSB
+RSB
+DOTLENGTH
+LP
+RP
+RETURN
+EQ
+Final
+BooleanLiteral
+IntegerLiteral
+NullLiteral
+Identifier
+String
+Override
+WS
+MULTILINE_COMMENT
+LINE_COMMENT
+
+rule names:
+program
+mainClass
+mainMethod
+classDeclaration
+interfaceDeclaration
+interfaceMethodDeclaration
+fieldDeclaration
+localDeclaration
+methodDeclaration
+parameterList
+parameter
+methodBody
+type
+javaType
+returnType
+accessModifier
+statement
+ifBlock
+elseBlock
+whileBlock
+expression
+
+
+atn:
+[4, 1, 46, 350, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 1, 0, 1, 0, 5, 0, 46, 8, 0, 10, 0, 12, 0, 49, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 69, 8, 2, 10, 2, 12, 2, 72, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 80, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 86, 8, 3, 10, 3, 12, 3, 89, 9, 3, 3, 3, 91, 8, 3, 1, 3, 1, 3, 5, 3, 95, 8, 3, 10, 3, 12, 3, 98, 9, 3, 1, 3, 5, 3, 101, 8, 3, 10, 3, 12, 3, 104, 9, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 112, 8, 4, 10, 4, 12, 4, 115, 9, 4, 1, 4, 5, 4, 118, 8, 4, 10, 4, 12, 4, 121, 9, 4, 1, 4, 1, 4, 1, 5, 3, 5, 126, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 132, 8, 5, 1, 5, 1, 5, 1, 5, 1, 6, 3, 6, 138, 8, 6, 1, 6, 3, 6, 141, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 147, 8, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 3, 8, 156, 8, 8, 1, 8, 3, 8, 159, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 165, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 5, 9, 175, 8, 9, 10, 9, 12, 9, 178, 9, 9, 1, 10, 1, 10, 1, 10, 1, 11, 5, 11, 184, 8, 11, 10, 11, 12, 11, 187, 9, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 193, 8, 11, 1, 12, 1, 12, 3, 12, 197, 8, 12, 1, 12, 1, 12, 3, 12, 201, 8, 12, 1, 13, 1, 13, 3, 13, 205, 8, 13, 1, 14, 1, 14, 3, 14, 209, 8, 14, 1, 15, 1, 15, 1, 16, 1, 16, 5, 16, 215, 8, 16, 10, 16, 12, 16, 218, 9, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 228, 8, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 259, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 280, 8, 20, 10, 20, 12, 20, 283, 9, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 300, 8, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 334, 8, 20, 10, 20, 12, 20, 337, 9, 20, 3, 20, 339, 8, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 345, 8, 20, 10, 20, 12, 20, 348, 9, 20, 1, 20, 0, 1, 40, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 0, 2, 2, 0, 4, 4, 15, 15, 2, 0, 13, 14, 41, 41, 385, 0, 42, 1, 0, 0, 0, 2, 52, 1, 0, 0, 0, 4, 58, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 107, 1, 0, 0, 0, 10, 125, 1, 0, 0, 0, 12, 137, 1, 0, 0, 0, 14, 150, 1, 0, 0, 0, 16, 155, 1, 0, 0, 0, 18, 171, 1, 0, 0, 0, 20, 179, 1, 0, 0, 0, 22, 185, 1, 0, 0, 0, 24, 196, 1, 0, 0, 0, 26, 204, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 210, 1, 0, 0, 0, 32, 258, 1, 0, 0, 0, 34, 260, 1, 0, 0, 0, 36, 262, 1, 0, 0, 0, 38, 264, 1, 0, 0, 0, 40, 299, 1, 0, 0, 0, 42, 47, 3, 2, 1, 0, 43, 46, 3, 6, 3, 0, 44, 46, 3, 8, 4, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 50, 51, 5, 0, 0, 1, 51, 1, 1, 0, 0, 0, 52, 53, 5, 1, 0, 0, 53, 54, 5, 41, 0, 0, 54, 55, 5, 2, 0, 0, 55, 56, 3, 4, 2, 0, 56, 57, 5, 3, 0, 0, 57, 3, 1, 0, 0, 0, 58, 59, 5, 4, 0, 0, 59, 60, 5, 5, 0, 0, 60, 61, 5, 6, 0, 0, 61, 62, 5, 7, 0, 0, 62, 63, 5, 33, 0, 0, 63, 64, 3, 24, 12, 0, 64, 65, 5, 41, 0, 0, 65, 66, 5, 34, 0, 0, 66, 70, 5, 2, 0, 0, 67, 69, 3, 32, 16, 0, 68, 67, 1, 0, 0, 0, 69, 72, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 73, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 73, 74, 5, 3, 0, 0, 74, 5, 1, 0, 0, 0, 75, 76, 5, 1, 0, 0, 76, 79, 5, 41, 0, 0, 77, 78, 5, 8, 0, 0, 78, 80, 5, 41, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 90, 1, 0, 0, 0, 81, 82, 5, 9, 0, 0, 82, 87, 5, 41, 0, 0, 83, 84, 5, 10, 0, 0, 84, 86, 5, 41, 0, 0, 85, 83, 1, 0, 0, 0, 86, 89, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 90, 81, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 96, 5, 2, 0, 0, 93, 95, 3, 12, 6, 0, 94, 93, 1, 0, 0, 0, 95, 98, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 102, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 99, 101, 3, 16, 8, 0, 100, 99, 1, 0, 0, 0, 101, 104, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 105, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 105, 106, 5, 3, 0, 0, 106, 7, 1, 0, 0, 0, 107, 108, 5, 11, 0, 0, 108, 109, 5, 41, 0, 0, 109, 113, 5, 2, 0, 0, 110, 112, 3, 12, 6, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 119, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 118, 3, 10, 5, 0, 117, 116, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 123, 5, 3, 0, 0, 123, 9, 1, 0, 0, 0, 124, 126, 3, 30, 15, 0, 125, 124, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 128, 3, 28, 14, 0, 128, 129, 5, 41, 0, 0, 129, 131, 5, 33, 0, 0, 130, 132, 3, 18, 9, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 5, 34, 0, 0, 134, 135, 5, 12, 0, 0, 135, 11, 1, 0, 0, 0, 136, 138, 3, 30, 15, 0, 137, 136, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 140, 1, 0, 0, 0, 139, 141, 5, 37, 0, 0, 140, 139, 1, 0, 0, 0, 140, 141, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 143, 3, 24, 12, 0, 143, 146, 5, 41, 0, 0, 144, 145, 5, 36, 0, 0, 145, 147, 3, 40, 20, 0, 146, 144, 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 5, 12, 0, 0, 149, 13, 1, 0, 0, 0, 150, 151, 3, 24, 12, 0, 151, 152, 5, 41, 0, 0, 152, 153, 5, 12, 0, 0, 153, 15, 1, 0, 0, 0, 154, 156, 5, 43, 0, 0, 155, 154, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 158, 1, 0, 0, 0, 157, 159, 3, 30, 15, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 161, 3, 28, 14, 0, 161, 162, 5, 41, 0, 0, 162, 164, 5, 33, 0, 0, 163, 165, 3, 18, 9, 0, 164, 163, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 167, 5, 34, 0, 0, 167, 168, 5, 2, 0, 0, 168, 169, 3, 22, 11, 0, 169, 170, 5, 3, 0, 0, 170, 17, 1, 0, 0, 0, 171, 176, 3, 20, 10, 0, 172, 173, 5, 10, 0, 0, 173, 175, 3, 20, 10, 0, 174, 172, 1, 0, 0, 0, 175, 178, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 19, 1, 0, 0, 0, 178, 176, 1, 0, 0, 0, 179, 180, 3, 24, 12, 0, 180, 181, 5, 41, 0, 0, 181, 21, 1, 0, 0, 0, 182, 184, 3, 32, 16, 0, 183, 182, 1, 0, 0, 0, 184, 187, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 192, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 188, 189, 5, 35, 0, 0, 189, 190, 3, 40, 20, 0, 190, 191, 5, 12, 0, 0, 191, 193, 1, 0, 0, 0, 192, 188, 1, 0, 0, 0, 192, 193, 1, 0, 0, 0, 193, 23, 1, 0, 0, 0, 194, 197, 3, 26, 13, 0, 195, 197, 5, 41, 0, 0, 196, 194, 1, 0, 0, 0, 196, 195, 1, 0, 0, 0, 197, 200, 1, 0, 0, 0, 198, 199, 5, 30, 0, 0, 199, 201, 5, 31, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 25, 1, 0, 0, 0, 202, 205, 5, 13, 0, 0, 203, 205, 5, 14, 0, 0, 204, 202, 1, 0, 0, 0, 204, 203, 1, 0, 0, 0, 205, 27, 1, 0, 0, 0, 206, 209, 3, 24, 12, 0, 207, 209, 5, 6, 0, 0, 208, 206, 1, 0, 0, 0, 208, 207, 1, 0, 0, 0, 209, 29, 1, 0, 0, 0, 210, 211, 7, 0, 0, 0, 211, 31, 1, 0, 0, 0, 212, 216, 5, 2, 0, 0, 213, 215, 3, 32, 16, 0, 214, 213, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 219, 259, 5, 3, 0, 0, 220, 221, 5, 16, 0, 0, 221, 222, 5, 33, 0, 0, 222, 223, 3, 40, 20, 0, 223, 224, 5, 34, 0, 0, 224, 227, 3, 34, 17, 0, 225, 226, 5, 17, 0, 0, 226, 228, 3, 36, 18, 0, 227, 225, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 259, 1, 0, 0, 0, 229, 230, 5, 18, 0, 0, 230, 231, 5, 33, 0, 0, 231, 232, 3, 40, 20, 0, 232, 233, 5, 34, 0, 0, 233, 234, 3, 38, 19, 0, 234, 259, 1, 0, 0, 0, 235, 236, 5, 19, 0, 0, 236, 237, 5, 33, 0, 0, 237, 238, 3, 40, 20, 0, 238, 239, 5, 34, 0, 0, 239, 240, 5, 12, 0, 0, 240, 259, 1, 0, 0, 0, 241, 242, 3, 40, 20, 0, 242, 243, 5, 36, 0, 0, 243, 244, 3, 40, 20, 0, 244, 245, 5, 12, 0, 0, 245, 259, 1, 0, 0, 0, 246, 247, 5, 41, 0, 0, 247, 248, 5, 30, 0, 0, 248, 249, 3, 40, 20, 0, 249, 250, 5, 31, 0, 0, 250, 251, 5, 36, 0, 0, 251, 252, 3, 40, 20, 0, 252, 253, 5, 12, 0, 0, 253, 259, 1, 0, 0, 0, 254, 259, 3, 14, 7, 0, 255, 256, 3, 40, 20, 0, 256, 257, 5, 12, 0, 0, 257, 259, 1, 0, 0, 0, 258, 212, 1, 0, 0, 0, 258, 220, 1, 0, 0, 0, 258, 229, 1, 0, 0, 0, 258, 235, 1, 0, 0, 0, 258, 241, 1, 0, 0, 0, 258, 246, 1, 0, 0, 0, 258, 254, 1, 0, 0, 0, 258, 255, 1, 0, 0, 0, 259, 33, 1, 0, 0, 0, 260, 261, 3, 32, 16, 0, 261, 35, 1, 0, 0, 0, 262, 263, 3, 32, 16, 0, 263, 37, 1, 0, 0, 0, 264, 265, 3, 32, 16, 0, 265, 39, 1, 0, 0, 0, 266, 267, 6, 20, -1, 0, 267, 268, 5, 29, 0, 0, 268, 300, 3, 40, 20, 17, 269, 270, 5, 21, 0, 0, 270, 271, 7, 1, 0, 0, 271, 272, 5, 30, 0, 0, 272, 273, 3, 40, 20, 0, 273, 274, 5, 31, 0, 0, 274, 300, 1, 0, 0, 0, 275, 276, 5, 2, 0, 0, 276, 281, 5, 39, 0, 0, 277, 278, 5, 10, 0, 0, 278, 280, 5, 39, 0, 0, 279, 277, 1, 0, 0, 0, 280, 283, 1, 0, 0, 0, 281, 279, 1, 0, 0, 0, 281, 282, 1, 0, 0, 0, 282, 284, 1, 0, 0, 0, 283, 281, 1, 0, 0, 0, 284, 300, 5, 3, 0, 0, 285, 286, 5, 21, 0, 0, 286, 287, 5, 41, 0, 0, 287, 288, 5, 33, 0, 0, 288, 300, 5, 34, 0, 0, 289, 300, 5, 39, 0, 0, 290, 300, 5, 38, 0, 0, 291, 300, 5, 40, 0, 0, 292, 300, 5, 41, 0, 0, 293, 300, 5, 42, 0, 0, 294, 300, 5, 22, 0, 0, 295, 296, 5, 33, 0, 0, 296, 297, 3, 40, 20, 0, 297, 298, 5, 34, 0, 0, 298, 300, 1, 0, 0, 0, 299, 266, 1, 0, 0, 0, 299, 269, 1, 0, 0, 0, 299, 275, 1, 0, 0, 0, 299, 285, 1, 0, 0, 0, 299, 289, 1, 0, 0, 0, 299, 290, 1, 0, 0, 0, 299, 291, 1, 0, 0, 0, 299, 292, 1, 0, 0, 0, 299, 293, 1, 0, 0, 0, 299, 294, 1, 0, 0, 0, 299, 295, 1, 0, 0, 0, 300, 346, 1, 0, 0, 0, 301, 302, 10, 13, 0, 0, 302, 303, 5, 28, 0, 0, 303, 345, 3, 40, 20, 14, 304, 305, 10, 12, 0, 0, 305, 306, 5, 27, 0, 0, 306, 345, 3, 40, 20, 13, 307, 308, 10, 11, 0, 0, 308, 309, 5, 25, 0, 0, 309, 345, 3, 40, 20, 12, 310, 311, 10, 10, 0, 0, 311, 312, 5, 26, 0, 0, 312, 345, 3, 40, 20, 11, 313, 314, 10, 9, 0, 0, 314, 315, 5, 24, 0, 0, 315, 345, 3, 40, 20, 10, 316, 317, 10, 8, 0, 0, 317, 318, 5, 23, 0, 0, 318, 345, 3, 40, 20, 9, 319, 320, 10, 21, 0, 0, 320, 321, 5, 30, 0, 0, 321, 322, 3, 40, 20, 0, 322, 323, 5, 31, 0, 0, 323, 345, 1, 0, 0, 0, 324, 325, 10, 20, 0, 0, 325, 345, 5, 32, 0, 0, 326, 327, 10, 19, 0, 0, 327, 328, 5, 20, 0, 0, 328, 329, 5, 41, 0, 0, 329, 338, 5, 33, 0, 0, 330, 335, 3, 40, 20, 0, 331, 332, 5, 10, 0, 0, 332, 334, 3, 40, 20, 0, 333, 331, 1, 0, 0, 0, 334, 337, 1, 0, 0, 0, 335, 333, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 339, 1, 0, 0, 0, 337, 335, 1, 0, 0, 0, 338, 330, 1, 0, 0, 0, 338, 339, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 345, 5, 34, 0, 0, 341, 342, 10, 18, 0, 0, 342, 343, 5, 20, 0, 0, 343, 345, 5, 41, 0, 0, 344, 301, 1, 0, 0, 0, 344, 304, 1, 0, 0, 0, 344, 307, 1, 0, 0, 0, 344, 310, 1, 0, 0, 0, 344, 313, 1, 0, 0, 0, 344, 316, 1, 0, 0, 0, 344, 319, 1, 0, 0, 0, 344, 324, 1, 0, 0, 0, 344, 326, 1, 0, 0, 0, 344, 341, 1, 0, 0, 0, 345, 348, 1, 0, 0, 0, 346, 344, 1, 0, 0, 0, 346, 347, 1, 0, 0, 0, 347, 41, 1, 0, 0, 0, 348, 346, 1, 0, 0, 0, 34, 45, 47, 70, 79, 87, 90, 96, 102, 113, 119, 125, 131, 137, 140, 146, 155, 158, 164, 176, 185, 192, 196, 200, 204, 208, 216, 227, 258, 281, 299, 335, 338, 344, 346]
\ No newline at end of file
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJava.tokens b/out/production/CompilerFinalProject-main/gen/MiniJava.tokens
new file mode 100644
index 0000000..8a09db5
--- /dev/null
+++ b/out/production/CompilerFinalProject-main/gen/MiniJava.tokens
@@ -0,0 +1,85 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+AND=23
+LT=24
+PLUS=25
+MINUS=26
+TIMES=27
+POWER=28
+NOT=29
+LSB=30
+RSB=31
+DOTLENGTH=32
+LP=33
+RP=34
+RETURN=35
+EQ=36
+Final=37
+BooleanLiteral=38
+IntegerLiteral=39
+NullLiteral=40
+Identifier=41
+String=42
+Override=43
+WS=44
+MULTILINE_COMMENT=45
+LINE_COMMENT=46
+'class'=1
+'{'=2
+'}'=3
+'public'=4
+'static'=5
+'void'=6
+'main'=7
+'inherits'=8
+'implements'=9
+','=10
+'interface'=11
+';'=12
+'boolean'=13
+'number'=14
+'private'=15
+'if'=16
+'else'=17
+'while'=18
+'print'=19
+'.'=20
+'new'=21
+'this'=22
+'&&'=23
+'<'=24
+'+'=25
+'-'=26
+'*'=27
+'**'=28
+'<>'=29
+'['=30
+']'=31
+'.length'=32
+'('=33
+')'=34
+'ret'=35
+'='=36
+'final'=37
+'null'=40
+'@Override'=43
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaBaseListener.class b/out/production/CompilerFinalProject-main/gen/MiniJavaBaseListener.class
new file mode 100644
index 0000000..0a9b537
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaBaseListener.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaBaseVisitor.class b/out/production/CompilerFinalProject-main/gen/MiniJavaBaseVisitor.class
new file mode 100644
index 0000000..09713d4
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaBaseVisitor.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.class b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.class
new file mode 100644
index 0000000..48a1dc2
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.interp b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.interp
new file mode 100644
index 0000000..03beda8
--- /dev/null
+++ b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.interp
@@ -0,0 +1,166 @@
+token literal names:
+null
+'class'
+'{'
+'}'
+'public'
+'static'
+'void'
+'main'
+'inherits'
+'implements'
+','
+'interface'
+';'
+'boolean'
+'number'
+'private'
+'if'
+'else'
+'while'
+'print'
+'.'
+'new'
+'this'
+'&&'
+'<'
+'+'
+'-'
+'*'
+'**'
+'<>'
+'['
+']'
+'.length'
+'('
+')'
+'ret'
+'='
+'final'
+null
+null
+'null'
+null
+null
+'@Override'
+null
+null
+null
+
+token symbolic names:
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+AND
+LT
+PLUS
+MINUS
+TIMES
+POWER
+NOT
+LSB
+RSB
+DOTLENGTH
+LP
+RP
+RETURN
+EQ
+Final
+BooleanLiteral
+IntegerLiteral
+NullLiteral
+Identifier
+String
+Override
+WS
+MULTILINE_COMMENT
+LINE_COMMENT
+
+rule names:
+T__0
+T__1
+T__2
+T__3
+T__4
+T__5
+T__6
+T__7
+T__8
+T__9
+T__10
+T__11
+T__12
+T__13
+T__14
+T__15
+T__16
+T__17
+T__18
+T__19
+T__20
+T__21
+AND
+LT
+PLUS
+MINUS
+TIMES
+POWER
+NOT
+LSB
+RSB
+DOTLENGTH
+LP
+RP
+RETURN
+EQ
+Final
+BooleanLiteral
+IntegerLiteral
+NullLiteral
+Identifier
+String
+Override
+JavaLetter
+JavaLetterOrDigit
+DecimalIntegerLiteral
+IntegertypeSuffix
+DecimalNumeral
+Digits
+Digit
+NonZeroDigit
+DigitsAndUnderscores
+DigitOrUnderscore
+Underscores
+WS
+MULTILINE_COMMENT
+LINE_COMMENT
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 46, 409, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 292, 8, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 5, 40, 303, 8, 40, 10, 40, 12, 40, 306, 9, 40, 1, 41, 1, 41, 5, 41, 310, 8, 41, 10, 41, 12, 41, 313, 9, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 3, 45, 333, 8, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 3, 47, 340, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 345, 8, 47, 3, 47, 347, 8, 47, 1, 48, 1, 48, 3, 48, 351, 8, 48, 1, 48, 3, 48, 354, 8, 48, 1, 49, 1, 49, 3, 49, 358, 8, 49, 1, 50, 1, 50, 1, 51, 4, 51, 363, 8, 51, 11, 51, 12, 51, 364, 1, 52, 1, 52, 3, 52, 369, 8, 52, 1, 53, 4, 53, 372, 8, 53, 11, 53, 12, 53, 373, 1, 54, 4, 54, 377, 8, 54, 11, 54, 12, 54, 378, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 5, 55, 387, 8, 55, 10, 55, 12, 55, 390, 9, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 5, 56, 401, 8, 56, 10, 56, 12, 56, 404, 9, 56, 1, 56, 1, 56, 1, 56, 1, 56, 2, 388, 402, 0, 57, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 0, 89, 0, 91, 0, 93, 0, 95, 0, 97, 0, 99, 0, 101, 0, 103, 0, 105, 0, 107, 0, 109, 44, 111, 45, 113, 46, 1, 0, 6, 1, 0, 34, 34, 4, 0, 36, 36, 65, 90, 95, 95, 97, 122, 5, 0, 36, 36, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 76, 76, 108, 108, 1, 0, 49, 57, 3, 0, 9, 10, 13, 13, 32, 32, 413, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 1, 115, 1, 0, 0, 0, 3, 121, 1, 0, 0, 0, 5, 123, 1, 0, 0, 0, 7, 125, 1, 0, 0, 0, 9, 132, 1, 0, 0, 0, 11, 139, 1, 0, 0, 0, 13, 144, 1, 0, 0, 0, 15, 149, 1, 0, 0, 0, 17, 158, 1, 0, 0, 0, 19, 169, 1, 0, 0, 0, 21, 171, 1, 0, 0, 0, 23, 181, 1, 0, 0, 0, 25, 183, 1, 0, 0, 0, 27, 191, 1, 0, 0, 0, 29, 198, 1, 0, 0, 0, 31, 206, 1, 0, 0, 0, 33, 209, 1, 0, 0, 0, 35, 214, 1, 0, 0, 0, 37, 220, 1, 0, 0, 0, 39, 226, 1, 0, 0, 0, 41, 228, 1, 0, 0, 0, 43, 232, 1, 0, 0, 0, 45, 237, 1, 0, 0, 0, 47, 240, 1, 0, 0, 0, 49, 242, 1, 0, 0, 0, 51, 244, 1, 0, 0, 0, 53, 246, 1, 0, 0, 0, 55, 248, 1, 0, 0, 0, 57, 251, 1, 0, 0, 0, 59, 254, 1, 0, 0, 0, 61, 256, 1, 0, 0, 0, 63, 258, 1, 0, 0, 0, 65, 266, 1, 0, 0, 0, 67, 268, 1, 0, 0, 0, 69, 270, 1, 0, 0, 0, 71, 274, 1, 0, 0, 0, 73, 276, 1, 0, 0, 0, 75, 291, 1, 0, 0, 0, 77, 293, 1, 0, 0, 0, 79, 295, 1, 0, 0, 0, 81, 300, 1, 0, 0, 0, 83, 307, 1, 0, 0, 0, 85, 316, 1, 0, 0, 0, 87, 326, 1, 0, 0, 0, 89, 328, 1, 0, 0, 0, 91, 330, 1, 0, 0, 0, 93, 334, 1, 0, 0, 0, 95, 346, 1, 0, 0, 0, 97, 348, 1, 0, 0, 0, 99, 357, 1, 0, 0, 0, 101, 359, 1, 0, 0, 0, 103, 362, 1, 0, 0, 0, 105, 368, 1, 0, 0, 0, 107, 371, 1, 0, 0, 0, 109, 376, 1, 0, 0, 0, 111, 382, 1, 0, 0, 0, 113, 396, 1, 0, 0, 0, 115, 116, 5, 99, 0, 0, 116, 117, 5, 108, 0, 0, 117, 118, 5, 97, 0, 0, 118, 119, 5, 115, 0, 0, 119, 120, 5, 115, 0, 0, 120, 2, 1, 0, 0, 0, 121, 122, 5, 123, 0, 0, 122, 4, 1, 0, 0, 0, 123, 124, 5, 125, 0, 0, 124, 6, 1, 0, 0, 0, 125, 126, 5, 112, 0, 0, 126, 127, 5, 117, 0, 0, 127, 128, 5, 98, 0, 0, 128, 129, 5, 108, 0, 0, 129, 130, 5, 105, 0, 0, 130, 131, 5, 99, 0, 0, 131, 8, 1, 0, 0, 0, 132, 133, 5, 115, 0, 0, 133, 134, 5, 116, 0, 0, 134, 135, 5, 97, 0, 0, 135, 136, 5, 116, 0, 0, 136, 137, 5, 105, 0, 0, 137, 138, 5, 99, 0, 0, 138, 10, 1, 0, 0, 0, 139, 140, 5, 118, 0, 0, 140, 141, 5, 111, 0, 0, 141, 142, 5, 105, 0, 0, 142, 143, 5, 100, 0, 0, 143, 12, 1, 0, 0, 0, 144, 145, 5, 109, 0, 0, 145, 146, 5, 97, 0, 0, 146, 147, 5, 105, 0, 0, 147, 148, 5, 110, 0, 0, 148, 14, 1, 0, 0, 0, 149, 150, 5, 105, 0, 0, 150, 151, 5, 110, 0, 0, 151, 152, 5, 104, 0, 0, 152, 153, 5, 101, 0, 0, 153, 154, 5, 114, 0, 0, 154, 155, 5, 105, 0, 0, 155, 156, 5, 116, 0, 0, 156, 157, 5, 115, 0, 0, 157, 16, 1, 0, 0, 0, 158, 159, 5, 105, 0, 0, 159, 160, 5, 109, 0, 0, 160, 161, 5, 112, 0, 0, 161, 162, 5, 108, 0, 0, 162, 163, 5, 101, 0, 0, 163, 164, 5, 109, 0, 0, 164, 165, 5, 101, 0, 0, 165, 166, 5, 110, 0, 0, 166, 167, 5, 116, 0, 0, 167, 168, 5, 115, 0, 0, 168, 18, 1, 0, 0, 0, 169, 170, 5, 44, 0, 0, 170, 20, 1, 0, 0, 0, 171, 172, 5, 105, 0, 0, 172, 173, 5, 110, 0, 0, 173, 174, 5, 116, 0, 0, 174, 175, 5, 101, 0, 0, 175, 176, 5, 114, 0, 0, 176, 177, 5, 102, 0, 0, 177, 178, 5, 97, 0, 0, 178, 179, 5, 99, 0, 0, 179, 180, 5, 101, 0, 0, 180, 22, 1, 0, 0, 0, 181, 182, 5, 59, 0, 0, 182, 24, 1, 0, 0, 0, 183, 184, 5, 98, 0, 0, 184, 185, 5, 111, 0, 0, 185, 186, 5, 111, 0, 0, 186, 187, 5, 108, 0, 0, 187, 188, 5, 101, 0, 0, 188, 189, 5, 97, 0, 0, 189, 190, 5, 110, 0, 0, 190, 26, 1, 0, 0, 0, 191, 192, 5, 110, 0, 0, 192, 193, 5, 117, 0, 0, 193, 194, 5, 109, 0, 0, 194, 195, 5, 98, 0, 0, 195, 196, 5, 101, 0, 0, 196, 197, 5, 114, 0, 0, 197, 28, 1, 0, 0, 0, 198, 199, 5, 112, 0, 0, 199, 200, 5, 114, 0, 0, 200, 201, 5, 105, 0, 0, 201, 202, 5, 118, 0, 0, 202, 203, 5, 97, 0, 0, 203, 204, 5, 116, 0, 0, 204, 205, 5, 101, 0, 0, 205, 30, 1, 0, 0, 0, 206, 207, 5, 105, 0, 0, 207, 208, 5, 102, 0, 0, 208, 32, 1, 0, 0, 0, 209, 210, 5, 101, 0, 0, 210, 211, 5, 108, 0, 0, 211, 212, 5, 115, 0, 0, 212, 213, 5, 101, 0, 0, 213, 34, 1, 0, 0, 0, 214, 215, 5, 119, 0, 0, 215, 216, 5, 104, 0, 0, 216, 217, 5, 105, 0, 0, 217, 218, 5, 108, 0, 0, 218, 219, 5, 101, 0, 0, 219, 36, 1, 0, 0, 0, 220, 221, 5, 112, 0, 0, 221, 222, 5, 114, 0, 0, 222, 223, 5, 105, 0, 0, 223, 224, 5, 110, 0, 0, 224, 225, 5, 116, 0, 0, 225, 38, 1, 0, 0, 0, 226, 227, 5, 46, 0, 0, 227, 40, 1, 0, 0, 0, 228, 229, 5, 110, 0, 0, 229, 230, 5, 101, 0, 0, 230, 231, 5, 119, 0, 0, 231, 42, 1, 0, 0, 0, 232, 233, 5, 116, 0, 0, 233, 234, 5, 104, 0, 0, 234, 235, 5, 105, 0, 0, 235, 236, 5, 115, 0, 0, 236, 44, 1, 0, 0, 0, 237, 238, 5, 38, 0, 0, 238, 239, 5, 38, 0, 0, 239, 46, 1, 0, 0, 0, 240, 241, 5, 60, 0, 0, 241, 48, 1, 0, 0, 0, 242, 243, 5, 43, 0, 0, 243, 50, 1, 0, 0, 0, 244, 245, 5, 45, 0, 0, 245, 52, 1, 0, 0, 0, 246, 247, 5, 42, 0, 0, 247, 54, 1, 0, 0, 0, 248, 249, 5, 42, 0, 0, 249, 250, 5, 42, 0, 0, 250, 56, 1, 0, 0, 0, 251, 252, 5, 60, 0, 0, 252, 253, 5, 62, 0, 0, 253, 58, 1, 0, 0, 0, 254, 255, 5, 91, 0, 0, 255, 60, 1, 0, 0, 0, 256, 257, 5, 93, 0, 0, 257, 62, 1, 0, 0, 0, 258, 259, 5, 46, 0, 0, 259, 260, 5, 108, 0, 0, 260, 261, 5, 101, 0, 0, 261, 262, 5, 110, 0, 0, 262, 263, 5, 103, 0, 0, 263, 264, 5, 116, 0, 0, 264, 265, 5, 104, 0, 0, 265, 64, 1, 0, 0, 0, 266, 267, 5, 40, 0, 0, 267, 66, 1, 0, 0, 0, 268, 269, 5, 41, 0, 0, 269, 68, 1, 0, 0, 0, 270, 271, 5, 114, 0, 0, 271, 272, 5, 101, 0, 0, 272, 273, 5, 116, 0, 0, 273, 70, 1, 0, 0, 0, 274, 275, 5, 61, 0, 0, 275, 72, 1, 0, 0, 0, 276, 277, 5, 102, 0, 0, 277, 278, 5, 105, 0, 0, 278, 279, 5, 110, 0, 0, 279, 280, 5, 97, 0, 0, 280, 281, 5, 108, 0, 0, 281, 74, 1, 0, 0, 0, 282, 283, 5, 116, 0, 0, 283, 284, 5, 114, 0, 0, 284, 285, 5, 117, 0, 0, 285, 292, 5, 101, 0, 0, 286, 287, 5, 102, 0, 0, 287, 288, 5, 97, 0, 0, 288, 289, 5, 108, 0, 0, 289, 290, 5, 115, 0, 0, 290, 292, 5, 101, 0, 0, 291, 282, 1, 0, 0, 0, 291, 286, 1, 0, 0, 0, 292, 76, 1, 0, 0, 0, 293, 294, 3, 91, 45, 0, 294, 78, 1, 0, 0, 0, 295, 296, 5, 110, 0, 0, 296, 297, 5, 117, 0, 0, 297, 298, 5, 108, 0, 0, 298, 299, 5, 108, 0, 0, 299, 80, 1, 0, 0, 0, 300, 304, 3, 87, 43, 0, 301, 303, 3, 89, 44, 0, 302, 301, 1, 0, 0, 0, 303, 306, 1, 0, 0, 0, 304, 302, 1, 0, 0, 0, 304, 305, 1, 0, 0, 0, 305, 82, 1, 0, 0, 0, 306, 304, 1, 0, 0, 0, 307, 311, 5, 34, 0, 0, 308, 310, 8, 0, 0, 0, 309, 308, 1, 0, 0, 0, 310, 313, 1, 0, 0, 0, 311, 309, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 314, 1, 0, 0, 0, 313, 311, 1, 0, 0, 0, 314, 315, 5, 34, 0, 0, 315, 84, 1, 0, 0, 0, 316, 317, 5, 64, 0, 0, 317, 318, 5, 79, 0, 0, 318, 319, 5, 118, 0, 0, 319, 320, 5, 101, 0, 0, 320, 321, 5, 114, 0, 0, 321, 322, 5, 114, 0, 0, 322, 323, 5, 105, 0, 0, 323, 324, 5, 100, 0, 0, 324, 325, 5, 101, 0, 0, 325, 86, 1, 0, 0, 0, 326, 327, 7, 1, 0, 0, 327, 88, 1, 0, 0, 0, 328, 329, 7, 2, 0, 0, 329, 90, 1, 0, 0, 0, 330, 332, 3, 95, 47, 0, 331, 333, 3, 93, 46, 0, 332, 331, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 92, 1, 0, 0, 0, 334, 335, 7, 3, 0, 0, 335, 94, 1, 0, 0, 0, 336, 347, 5, 48, 0, 0, 337, 344, 3, 101, 50, 0, 338, 340, 3, 97, 48, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 345, 1, 0, 0, 0, 341, 342, 3, 107, 53, 0, 342, 343, 3, 97, 48, 0, 343, 345, 1, 0, 0, 0, 344, 339, 1, 0, 0, 0, 344, 341, 1, 0, 0, 0, 345, 347, 1, 0, 0, 0, 346, 336, 1, 0, 0, 0, 346, 337, 1, 0, 0, 0, 347, 96, 1, 0, 0, 0, 348, 353, 3, 99, 49, 0, 349, 351, 3, 103, 51, 0, 350, 349, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 354, 3, 99, 49, 0, 353, 350, 1, 0, 0, 0, 353, 354, 1, 0, 0, 0, 354, 98, 1, 0, 0, 0, 355, 358, 5, 48, 0, 0, 356, 358, 3, 101, 50, 0, 357, 355, 1, 0, 0, 0, 357, 356, 1, 0, 0, 0, 358, 100, 1, 0, 0, 0, 359, 360, 7, 4, 0, 0, 360, 102, 1, 0, 0, 0, 361, 363, 3, 105, 52, 0, 362, 361, 1, 0, 0, 0, 363, 364, 1, 0, 0, 0, 364, 362, 1, 0, 0, 0, 364, 365, 1, 0, 0, 0, 365, 104, 1, 0, 0, 0, 366, 369, 3, 99, 49, 0, 367, 369, 5, 95, 0, 0, 368, 366, 1, 0, 0, 0, 368, 367, 1, 0, 0, 0, 369, 106, 1, 0, 0, 0, 370, 372, 5, 95, 0, 0, 371, 370, 1, 0, 0, 0, 372, 373, 1, 0, 0, 0, 373, 371, 1, 0, 0, 0, 373, 374, 1, 0, 0, 0, 374, 108, 1, 0, 0, 0, 375, 377, 7, 5, 0, 0, 376, 375, 1, 0, 0, 0, 377, 378, 1, 0, 0, 0, 378, 376, 1, 0, 0, 0, 378, 379, 1, 0, 0, 0, 379, 380, 1, 0, 0, 0, 380, 381, 6, 54, 0, 0, 381, 110, 1, 0, 0, 0, 382, 383, 5, 47, 0, 0, 383, 384, 5, 42, 0, 0, 384, 388, 1, 0, 0, 0, 385, 387, 9, 0, 0, 0, 386, 385, 1, 0, 0, 0, 387, 390, 1, 0, 0, 0, 388, 389, 1, 0, 0, 0, 388, 386, 1, 0, 0, 0, 389, 391, 1, 0, 0, 0, 390, 388, 1, 0, 0, 0, 391, 392, 5, 42, 0, 0, 392, 393, 5, 47, 0, 0, 393, 394, 1, 0, 0, 0, 394, 395, 6, 55, 0, 0, 395, 112, 1, 0, 0, 0, 396, 397, 5, 47, 0, 0, 397, 398, 5, 47, 0, 0, 398, 402, 1, 0, 0, 0, 399, 401, 9, 0, 0, 0, 400, 399, 1, 0, 0, 0, 401, 404, 1, 0, 0, 0, 402, 403, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 403, 405, 1, 0, 0, 0, 404, 402, 1, 0, 0, 0, 405, 406, 5, 10, 0, 0, 406, 407, 1, 0, 0, 0, 407, 408, 6, 56, 0, 0, 408, 114, 1, 0, 0, 0, 17, 0, 291, 304, 311, 332, 339, 344, 346, 350, 353, 357, 364, 368, 373, 378, 388, 402, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.tokens b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.tokens
new file mode 100644
index 0000000..8a09db5
--- /dev/null
+++ b/out/production/CompilerFinalProject-main/gen/MiniJavaLexer.tokens
@@ -0,0 +1,85 @@
+T__0=1
+T__1=2
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+T__6=7
+T__7=8
+T__8=9
+T__9=10
+T__10=11
+T__11=12
+T__12=13
+T__13=14
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+AND=23
+LT=24
+PLUS=25
+MINUS=26
+TIMES=27
+POWER=28
+NOT=29
+LSB=30
+RSB=31
+DOTLENGTH=32
+LP=33
+RP=34
+RETURN=35
+EQ=36
+Final=37
+BooleanLiteral=38
+IntegerLiteral=39
+NullLiteral=40
+Identifier=41
+String=42
+Override=43
+WS=44
+MULTILINE_COMMENT=45
+LINE_COMMENT=46
+'class'=1
+'{'=2
+'}'=3
+'public'=4
+'static'=5
+'void'=6
+'main'=7
+'inherits'=8
+'implements'=9
+','=10
+'interface'=11
+';'=12
+'boolean'=13
+'number'=14
+'private'=15
+'if'=16
+'else'=17
+'while'=18
+'print'=19
+'.'=20
+'new'=21
+'this'=22
+'&&'=23
+'<'=24
+'+'=25
+'-'=26
+'*'=27
+'**'=28
+'<>'=29
+'['=30
+']'=31
+'.length'=32
+'('=33
+')'=34
+'ret'=35
+'='=36
+'final'=37
+'null'=40
+'@Override'=43
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaListener.class b/out/production/CompilerFinalProject-main/gen/MiniJavaListener.class
new file mode 100644
index 0000000..ace6976
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaListener.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AccessModifierContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AccessModifierContext.class
new file mode 100644
index 0000000..5ba9d10
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AccessModifierContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AddExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AddExpressionContext.class
new file mode 100644
index 0000000..2b21247
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AddExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AndExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AndExpressionContext.class
new file mode 100644
index 0000000..8e70df9
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$AndExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAccessExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAccessExpressionContext.class
new file mode 100644
index 0000000..9a9fe87
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAccessExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAssignmentStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAssignmentStatementContext.class
new file mode 100644
index 0000000..57b605c
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayAssignmentStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayInstantiationExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayInstantiationExpressionContext.class
new file mode 100644
index 0000000..178280f
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayInstantiationExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayLengthExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayLengthExpressionContext.class
new file mode 100644
index 0000000..590dca2
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ArrayLengthExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanLitExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanLitExpressionContext.class
new file mode 100644
index 0000000..a034510
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanLitExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanTypeContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanTypeContext.class
new file mode 100644
index 0000000..0f04cb0
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$BooleanTypeContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ClassDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ClassDeclarationContext.class
new file mode 100644
index 0000000..197f86f
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ClassDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ElseBlockContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ElseBlockContext.class
new file mode 100644
index 0000000..9afcbf4
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ElseBlockContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressionContext.class
new file mode 100644
index 0000000..57c5b21
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressioncallContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressioncallContext.class
new file mode 100644
index 0000000..654b084
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ExpressioncallContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldCallExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldCallExpressionContext.class
new file mode 100644
index 0000000..0378276
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldCallExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldDeclarationContext.class
new file mode 100644
index 0000000..2c9708b
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$FieldDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IdentifierExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IdentifierExpressionContext.class
new file mode 100644
index 0000000..1e1f847
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IdentifierExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfBlockContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfBlockContext.class
new file mode 100644
index 0000000..320eb77
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfBlockContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfElseStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfElseStatementContext.class
new file mode 100644
index 0000000..9c42f51
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IfElseStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntLitExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntLitExpressionContext.class
new file mode 100644
index 0000000..2c8dfe8
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntLitExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntarrayInstantiationExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntarrayInstantiationExpressionContext.class
new file mode 100644
index 0000000..e87893a
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$IntarrayInstantiationExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceDeclarationContext.class
new file mode 100644
index 0000000..590fa9f
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceMethodDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceMethodDeclarationContext.class
new file mode 100644
index 0000000..d148607
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$InterfaceMethodDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$JavaTypeContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$JavaTypeContext.class
new file mode 100644
index 0000000..9997989
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$JavaTypeContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalDeclarationContext.class
new file mode 100644
index 0000000..f307882
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalVarDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalVarDeclarationContext.class
new file mode 100644
index 0000000..c31be9e
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LocalVarDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LtExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LtExpressionContext.class
new file mode 100644
index 0000000..393e707
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$LtExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainClassContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainClassContext.class
new file mode 100644
index 0000000..f0bb778
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainClassContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainMethodContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainMethodContext.class
new file mode 100644
index 0000000..e704b35
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MainMethodContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodBodyContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodBodyContext.class
new file mode 100644
index 0000000..c4c5dad
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodBodyContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodCallExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodCallExpressionContext.class
new file mode 100644
index 0000000..cd2b97b
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodCallExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodDeclarationContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodDeclarationContext.class
new file mode 100644
index 0000000..ab05df7
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MethodDeclarationContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MulExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MulExpressionContext.class
new file mode 100644
index 0000000..5ce255f
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$MulExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NestedStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NestedStatementContext.class
new file mode 100644
index 0000000..7c5b13f
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NestedStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NotExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NotExpressionContext.class
new file mode 100644
index 0000000..742af9d
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NotExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NullLitExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NullLitExpressionContext.class
new file mode 100644
index 0000000..f7086c9
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$NullLitExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ObjectInstantiationExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ObjectInstantiationExpressionContext.class
new file mode 100644
index 0000000..30d3f51
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ObjectInstantiationExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterContext.class
new file mode 100644
index 0000000..f398238
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterListContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterListContext.class
new file mode 100644
index 0000000..fb2e672
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParameterListContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParenExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParenExpressionContext.class
new file mode 100644
index 0000000..ffb5e49
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ParenExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PowExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PowExpressionContext.class
new file mode 100644
index 0000000..2a90e89
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PowExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PrintStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PrintStatementContext.class
new file mode 100644
index 0000000..e64efc8
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$PrintStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ProgramContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ProgramContext.class
new file mode 100644
index 0000000..50f0361
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ProgramContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ReturnTypeContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ReturnTypeContext.class
new file mode 100644
index 0000000..4468e47
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ReturnTypeContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StatementContext.class
new file mode 100644
index 0000000..8f84d2d
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StringLitExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StringLitExpressionContext.class
new file mode 100644
index 0000000..756a359
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$StringLitExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$SubExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$SubExpressionContext.class
new file mode 100644
index 0000000..23288d9
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$SubExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ThisExpressionContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ThisExpressionContext.class
new file mode 100644
index 0000000..d62e929
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$ThisExpressionContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$TypeContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$TypeContext.class
new file mode 100644
index 0000000..db29430
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$TypeContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$VariableAssignmentStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$VariableAssignmentStatementContext.class
new file mode 100644
index 0000000..b0bbc6e
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$VariableAssignmentStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileBlockContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileBlockContext.class
new file mode 100644
index 0000000..9063462
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileBlockContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileStatementContext.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileStatementContext.class
new file mode 100644
index 0000000..e6dbb51
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser$WhileStatementContext.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaParser.class b/out/production/CompilerFinalProject-main/gen/MiniJavaParser.class
new file mode 100644
index 0000000..5a064c1
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaParser.class differ
diff --git a/out/production/CompilerFinalProject-main/gen/MiniJavaVisitor.class b/out/production/CompilerFinalProject-main/gen/MiniJavaVisitor.class
new file mode 100644
index 0000000..4e4b8ac
Binary files /dev/null and b/out/production/CompilerFinalProject-main/gen/MiniJavaVisitor.class differ
diff --git a/sample/test3.jm b/sample/test3.jm
new file mode 100644
index 0000000..939d86d
--- /dev/null
+++ b/sample/test3.jm
@@ -0,0 +1,77 @@
+class Classes {
+public static void main(String[] args) {
+Base b;
+Derived d;
+number x;
+b = new Base();
+d = new Derived();
+{
+b = d;
+}
+print(b.set(1));
+print(b.set(3));
+}
+}
+class Rest implements Nothing{
+}
+class Base inherits Rest implements Face,MyFace{
+Hi data = g;
+private Rest[] d;
+private number set(Hi[] x) {
+number[] a;
+data = x;
+ret data;
+}
+public number get() {
+ret data;
+}
+private number test(){
+while(1)
+number x;
+number b ;
+c.get();
+{
+number t;
+a = 0;
+b = 5;
+}
+if(true){
+boolean n;
+{ }
+}
+ret a + b;
+}
+}
+class Derived inherits Base {
+public number set(number x, C d) {
+data = x * 2;
+{
+Base[] t;
+}
+if (a<0){
+ while(a<2){
+ if(a<2){
+ }
+ }
+ if(a<2){
+
+ }
+ else{
+ }
+}
+number a;
+a = 6;
+ret data;
+}
+}
+class Hi {
+private void sayHi(number one, boolean two, Hi three, number four){
+}
+}
+interface Face{
+final number[] a = {1,2};
+number getFace(number te);
+}
+interface MyFace{
+final String myFace= ":)";
+}
\ No newline at end of file
diff --git a/src/compiler/Compiler.java b/src/compiler/Compiler.java
index b99b7ef..38c1477 100644
--- a/src/compiler/Compiler.java
+++ b/src/compiler/Compiler.java
@@ -13,7 +13,7 @@
public class Compiler {
public static void main(String[] args) throws IOException {
- CharStream stream = CharStreams.fromFileName("./sample/test.jm");
+ CharStream stream = CharStreams.fromFileName("./sample/test3.jm");
MiniJavaLexer lexer = new MiniJavaLexer(stream);
TokenStream tokens = new CommonTokenStream(lexer);
MiniJavaParser parser = new MiniJavaParser(tokens);
diff --git a/src/compiler/ProgramPrinter.java b/src/compiler/ProgramPrinter.java
index ce50119..0e53693 100644
--- a/src/compiler/ProgramPrinter.java
+++ b/src/compiler/ProgramPrinter.java
@@ -6,221 +6,216 @@
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
-import java.util.Stack;
+import java.util.*;
public class ProgramPrinter implements MiniJavaListener {
- public static int indent_level = 0;
- private boolean nestedBlockForStatement = false;
- private Stack nestedBlockStack = new Stack();
+ Stack currentScope;
+ Queue scopes;
+ int nested = 0;
+ int id = 0;
- private String typeCheck(MiniJavaParser.TypeContext miniJavaDataType){
- String type;
-
- if (miniJavaDataType.javaType() != null){
- type = (miniJavaDataType.javaType().getText().equals("number")) ? "int" : miniJavaDataType.javaType().getText() ;
- }else {
- type = (miniJavaDataType.Identifier().getText().equals("number")) ? "int" : miniJavaDataType.Identifier().getText() ;
- }
-
- if (miniJavaDataType.LSB() != null)
- type = type.concat(miniJavaDataType.LSB().getText());
- if (miniJavaDataType.RSB() != null)
- type = type.concat(miniJavaDataType.RSB().getText());
-
- return type;
- }
-
- private String interfaceMethodSignature (MiniJavaParser.InterfaceMethodDeclarationContext methodNode){
- String str = "\t";
-
- if(methodNode.accessModifier() != null){
- str = str.concat(methodNode.accessModifier().getText() + " ");
- }
- if (methodNode.returnType().type() == null){
- str = str.concat(methodNode.returnType().getText() + " ");
- }else{
- str = str.concat(this.typeCheck(methodNode.returnType().type()) + " ");
- }
-
- str = str.concat(methodNode.Identifier().getText() + " (");
- //System.out.println(methodNode.parameterList().parameter().get(0).type().getText());
- if (methodNode.parameterList() != null) {
- for (int i = 0; i <= methodNode.parameterList().parameter().size() - 1; i++) {
- str = str.concat(this.typeCheck(methodNode.parameterList().parameter().get(i).type()) + " " + methodNode.parameterList().parameter().get(i).Identifier());
- if (i != methodNode.parameterList().parameter().size() - 1) {
- str = str.concat(", ");
- } else {
- str = str.concat(");\n");
- }
- }
- }else{
- str = str.concat(");\n");
- }
-
- return str;
- }
-
- private String classMethodSignature (MiniJavaParser.MethodDeclarationContext methodNode){
- String str = "\t";
-
- if (methodNode.Override() != null){
- str = str.concat(methodNode.Override().getText() + "\n\t");
- }
-
- if(methodNode.accessModifier() != null){
- str = str.concat(methodNode.accessModifier().getText() + " ");
- }
- if (methodNode.returnType().type() == null){
- str = str.concat(methodNode.returnType().getText() + " ");
- }else{
- str = str.concat(this.typeCheck(methodNode.returnType().type()) + " ");
- }
-
- str = str.concat(methodNode.Identifier().getText() + " (");
- //System.out.println(methodNode.parameterList().parameter().get(0).type().getText());
- if (methodNode.parameterList() != null) {
- for (int i = 0; i <= methodNode.parameterList().parameter().size() - 1; i++) {
- str = str.concat(this.typeCheck(methodNode.parameterList().parameter().get(i).type()) + " " + methodNode.parameterList().parameter().get(i).Identifier());
- if (i != methodNode.parameterList().parameter().size() - 1) {
- str = str.concat(", ");
- } else {
- str = str.concat(") {\n");
- }
- }
- }else{
- str = str.concat(") {\n");
- }
-
- return str;
- }
-
- private void tabPrint(int tabCount){
- for (int i=0; i();
+ this.scopes = new LinkedList();
}
- private String getExpression(MiniJavaParser.ExpressionContext expressionNode){
- if (expressionNode.start.getText().equals("new")){
- return expressionNode.getText().replace("new", "new ") ;
- }else {
- return expressionNode.getText();
+ private void printResult() {
+ Iterator it = this.scopes.iterator();
+ while (it.hasNext()){
+ SymbolTable s = ((SymbolTable)it.next());
+ s.print();
}
}
@Override
public void enterProgram(MiniJavaParser.ProgramContext ctx) {
-
+ SymbolTable s = new SymbolTable("Program", id++, 0);
+ this.currentScope.push(s);
+ this.scopes.add(s);
}
@Override
public void exitProgram(MiniJavaParser.ProgramContext ctx) {
-
+ this.printResult();
}
@Override
public void enterMainClass(MiniJavaParser.MainClassContext ctx) {
- System.out.print("class " + ctx.Identifier() + " {\n");
- indent_level += 1;
+// created this lines Symbol entry
+ String key = "Key = MainClass_" + ctx.className.getText();
+ String value = "Value = ";
+ value += "MainClass: (name: " + ctx.className.getText() + ")";
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+
+
+// created this scopes Symbol table
+ String name = "MainClass_" + ctx.className.getText();
+ int parentId =this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id++, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
+
+
}
@Override
public void exitMainClass(MiniJavaParser.MainClassContext ctx) {
- System.out.print("}\n");
- indent_level -= 1;
+ this.currentScope.pop();
}
@Override
public void enterMainMethod(MiniJavaParser.MainMethodContext ctx) {
- indent_level += 1;
- String str = "\tpublic static void main (";
- str = str.concat(this.typeCheck(ctx.type()));
-
- System.out.print(str + " " + ctx.Identifier() + "){\n");
-
+// created this lines Symbol table entry
+ String value = "Value = Method: (name: main) (returnType: void) (accessModifier: public) (parametersType: [array of [classType = String, isDefined = true] , index: 1] )";
+ String key = "Key = method_main";
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+// created this scopes Symbol table
+ String name = "method_main";
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id++, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
}
@Override
public void exitMainMethod(MiniJavaParser.MainMethodContext ctx) {
- indent_level -= 1;
- System.out.print("\t}\n");
+ this.currentScope.pop();
}
@Override
public void enterClassDeclaration(MiniJavaParser.ClassDeclarationContext ctx) {
- String str = "class " + ctx.className.getText() ;
- int interfaces_index;
-
- if (ctx.parentName != null){
- str = str.concat(" extends " + ctx.parentName.getText());
- interfaces_index = 2;
- }else{
- interfaces_index = 1;
+// created this line's Symbol table entry
+// the variable i is for iterating over implemented Identifiers in class declaration
+ int i = 1;
+ String value = "Value = Class: (name: " + ctx.className.getText() + ")";
+ if(ctx.inherits != null){
+ value += " (extends: " + ctx.Identifier(i++).getText() + ")";
}
- if (ctx.getText().contains("implements")){
- str = str.concat(" implements ");
- for (int i=interfaces_index; i<=ctx.Identifier().size()-1; i++){
- str = str.concat(ctx.Identifier().get(i).toString());
- if (i != ctx.Identifier().size()-1){
- str = str.concat(", ");
- }else{
- str = str.concat("{\n");
+ if(ctx.implements_ != null){
+ value += " (implements: ";
- }
+ for (;i < ctx.Identifier().size(); i++){
+ value += ctx.Identifier(i).getText();
+ value += ", ";
}
- }else{
- str = str.concat("{\n");
+ value += ")";
}
- System.out.print(str);
- indent_level += 1;
+ String key = "Key = class_" + ctx.className.getText();
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+
+// created this scopes Symbol table
+ String name = "Class_" + ctx.className.getText();
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id++, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
}
@Override
public void exitClassDeclaration(MiniJavaParser.ClassDeclarationContext ctx) {
- System.out.print("}\n");
- indent_level -= 1;
+ this.currentScope.pop();
}
@Override
public void enterInterfaceDeclaration(MiniJavaParser.InterfaceDeclarationContext ctx) {
- String str = "interface " + ctx.Identifier().getText() + " {\n";
- System.out.print(str);
- indent_level += 1;
+// created this line's symbol table entry
+ String value = "Value = interface: (name: " + ctx.Identifier().getText() + ")" ;
+ String key = "Key = inteface_" + ctx.Identifier().getText();
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+
+// created this scope's Symbol table
+ String name = "interface_" + ctx.Identifier().getText();
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
}
@Override
public void exitInterfaceDeclaration(MiniJavaParser.InterfaceDeclarationContext ctx) {
- System.out.print("}\n");
- indent_level -= 1;
+ this.currentScope.pop();
}
@Override
public void enterInterfaceMethodDeclaration(MiniJavaParser.InterfaceMethodDeclarationContext ctx) {
- System.out.print(interfaceMethodSignature(ctx));
+// created this line's symbol table entry
+ String key = "Key = method_" + ctx.Identifier().getText();
+ String value = "Value = Method: (name: " + ctx.Identifier().getText() + ") (returnType: " + ctx.returnType().getText() + ")";
+
+
+ if (ctx.accessModifier() != null){
+ value += " (accessModifier: " + ctx.accessModifier().getText() + ")";
+ }
+
+ if(ctx.parameterList() != null){
+ int i = 0;
+ int paramCount = ctx.parameterList().parameter().size();
+ value += " (parametersType: ";
+ for (;i < paramCount; i ++){
+ if(ctx.parameterList().parameter(i).type().javaType() != null){
+ value += "[" + ctx.parameterList().parameter(i).type().getText() + ", " + "index: " + (i + 1 ) + "]";
+ }
+ else {
+ value += "[ classType:" + ctx.parameterList().parameter(i).type().Identifier().getText() + ", " + "index: " + (i + 1 ) + "]";
+ }
+ }
+ }
+
+
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+
+// created symbol table for this scope
+ String name = "interface_method_" + ctx.Identifier().getText();
+ int parentId = this.currentScope.peek().id;
+ int line =ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
+
}
@Override
public void exitInterfaceMethodDeclaration(MiniJavaParser.InterfaceMethodDeclarationContext ctx) {
-
+ this.currentScope.pop();
}
@Override
public void enterFieldDeclaration(MiniJavaParser.FieldDeclarationContext ctx) {
- String str = "\t" ;
-
- if (ctx.accessModifier() != null)
- str = str.concat(ctx.accessModifier().getText() + " ");
- if (ctx.Final() != null)
- str = str.concat(ctx.Final().getText() + " ");
- str = str.concat(typeCheck(ctx.type()) + " " + ctx.Identifier() + " ");
-
- if (ctx.EQ() != null){
- str = str.concat(ctx.EQ().getText() + " " + this.getExpression(ctx.expression()) + " ;\n");
- }else{
- str = str.concat(";\n");
+// created this line's Symbol table entry
+ String key = "Key = var_" + ctx.Identifier().getText();
+ String value = "Value = Field: (name: " + ctx.Identifier().getText() + ")";
+
+
+ if(ctx.type().LSB() != null){
+ value += " (type: array of " ;
+ }
+ else {
+ value += " (type: ";
}
- System.out.print(str);
+ if(ctx.type().Identifier() != null){
+ value += "[ classType: " + ctx.type().Identifier().getText() + " ])";
+ }
+ else {
+ value += ctx.type().javaType().getText() + ")";
+ }
+
+ if(ctx.accessModifier() != null){
+ value += " (accesModifier: " + ctx.accessModifier().getText() + ")";
+ }
+
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
}
@Override
@@ -230,8 +225,26 @@ public void exitFieldDeclaration(MiniJavaParser.FieldDeclarationContext ctx) {
@Override
public void enterLocalDeclaration(MiniJavaParser.LocalDeclarationContext ctx) {
- tabPrint(indent_level);
- System.out.println(this.typeCheck(ctx.type()) + " " + ctx.Identifier() + ";");
+// created this line's Symbol table entry
+ String key = "Key = var_" + ctx.Identifier().getText();
+ String value = "Value = LocalVar: (name: " + ctx.Identifier().getText() + ")";
+
+ if(ctx.type().LSB() != null){
+ value += " (type: array of ";
+ }
+ else {
+ value += " (type: ";
+ }
+
+ if(ctx.type().javaType() != null){
+ value += ctx.type().javaType().getText() + ")";
+ }
+ else {
+ value += "[ classType: " + ctx.type().Identifier().getText() + " ])";
+ }
+
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
}
@Override
@@ -241,16 +254,42 @@ public void exitLocalDeclaration(MiniJavaParser.LocalDeclarationContext ctx) {
@Override
public void enterMethodDeclaration(MiniJavaParser.MethodDeclarationContext ctx) {
- System.out.print(classMethodSignature(ctx));
- indent_level += 1;
+// created this line's Symbol table entry
+ String key = "Key = mehtod_" + ctx.Identifier().getText();
+ String value = "Value = Method: (name: " + ctx.Identifier().getText() + ") (returnType: " + ctx.returnType().getText() + ")";
+ if(ctx.accessModifier() != null){
+ value += " (accessModifier: " + ctx.accessModifier().getText();
+ }
+
+ if(ctx.parameterList() != null){
+ int i = 0;
+ int paramCount = ctx.parameterList().parameter().size();
+ value += " (parametersType: ";
+ for (;i < paramCount; i ++){
+ if(ctx.parameterList().parameter(i).type().javaType() != null){
+ value += "[" + ctx.parameterList().parameter(i).type().getText() + ", " + "index: " + (i + 1 ) + "]";
+ }
+ else {
+ value += "[ classType:" + ctx.parameterList().parameter(i).type().Identifier().getText() + ", " + "index: " + (i + 1 ) + "]";
+ }
+ }
+ }
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
+
+
+// created this scope's Symbol table
+ String name = "method_" + ctx.Identifier().getText();
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
}
@Override
public void exitMethodDeclaration(MiniJavaParser.MethodDeclarationContext ctx) {
- if (ctx.methodBody().RETURN() != null)
- System.out.println("\t\treturn " + ctx.methodBody().expression().getText() + ";");
- System.out.print("\t}\n");
- indent_level -= 1;
+ this.currentScope.pop();
}
@Override
@@ -265,7 +304,25 @@ public void exitParameterList(MiniJavaParser.ParameterListContext ctx) {
@Override
public void enterParameter(MiniJavaParser.ParameterContext ctx) {
+// created this line's Symbol Table entry
+ String key = "Key = var_" + ctx.Identifier().getText();
+ String value = "value = Parameter: (name: " + ctx.Identifier().getText() + ")";
+ if(ctx.type().LSB() != null){
+ value += " (type: array of ";
+ }
+ else {
+ value += " (type: ";
+ }
+
+ if(ctx.type().javaType() != null){
+ value += ctx.type().javaType().getText() + ")";
+ }
+ else {
+ value += "[ classType: " + ctx.type().Identifier().getText() + "])";
+ }
+ SymbolTableEntry entry = new SymbolTableEntry(key, value);
+ this.currentScope.peek().symbolTable.put(key, entry);
}
@Override
@@ -325,71 +382,38 @@ public void exitAccessModifier(MiniJavaParser.AccessModifierContext ctx) {
@Override
public void enterNestedStatement(MiniJavaParser.NestedStatementContext ctx) {
- if (!nestedBlockForStatement) {
- tabPrint(indent_level);
- indent_level += 1;
- }
- nestedBlockStack.push(nestedBlockForStatement);
- nestedBlockForStatement = false;
- System.out.println("{");
+ this.nested++;
}
@Override
public void exitNestedStatement(MiniJavaParser.NestedStatementContext ctx) {
- boolean status = nestedBlockStack.pop();
- if (! status) {
- indent_level -= 1;
- tabPrint(indent_level);
- }else{
- tabPrint(indent_level-1);
- }
- System.out.println("}");
+ this.nested--;
}
@Override
public void enterIfElseStatement(MiniJavaParser.IfElseStatementContext ctx) {
- tabPrint(indent_level);
- String str = "if " + ctx.LP() + " " + ctx.expression().getText() + " " + ctx.RP() + " " ;
- System.out.print(str);
- indent_level += 1;
+
+
}
@Override
public void exitIfElseStatement(MiniJavaParser.IfElseStatementContext ctx) {
-// indent_level -= 1;
-// tabPrint(indent_level);
-// System.out.println("}");
+
}
@Override
public void enterWhileStatement(MiniJavaParser.WhileStatementContext ctx) {
- tabPrint(indent_level);
- String str = "while " + ctx.LP() + " " + ctx.expression().getText() + " " + ctx.RP() ;
- if (! ctx.whileBlock().getText().startsWith("{")) {
- str = str.concat(" {");
- System.out.println(str);
- }else{
- nestedBlockForStatement = true;
- System.out.print(str);
- }
- indent_level += 1;
}
@Override
public void exitWhileStatement(MiniJavaParser.WhileStatementContext ctx) {
- indent_level -= 1;
- if (! ctx.whileBlock().getText().startsWith("{")){
- tabPrint(indent_level);
- System.out.println("}");
- }
+
}
@Override
public void enterPrintStatement(MiniJavaParser.PrintStatementContext ctx) {
- tabPrint(indent_level);
- String str = "System.out.println ( " + ctx.expression().getText() + " );" ;
- System.out.println(str);
+
}
@Override
@@ -399,9 +423,7 @@ public void exitPrintStatement(MiniJavaParser.PrintStatementContext ctx) {
@Override
public void enterVariableAssignmentStatement(MiniJavaParser.VariableAssignmentStatementContext ctx) {
- tabPrint(indent_level);
- String str = this.getExpression(ctx.expression().get(0)) + " = " + this.getExpression(ctx.expression().get(1)) + ";" ;
- System.out.println(str);
+
}
@Override
@@ -441,51 +463,75 @@ public void exitExpressioncall(MiniJavaParser.ExpressioncallContext ctx) {
@Override
public void enterIfBlock(MiniJavaParser.IfBlockContext ctx) {
- if (! ctx.getText().startsWith("{")) {
- System.out.println("{");
- }else{
- nestedBlockForStatement = true;
+// created this scopes Symbol table
+ String name;
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ if(this.nested > 0){
+ name = "nested_if";
}
+ else {
+ name = "if";
+ }
+
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
+ this.nested++;
}
@Override
public void exitIfBlock(MiniJavaParser.IfBlockContext ctx) {
- indent_level -= 1;
- if (! ctx.getText().endsWith("}")){
- tabPrint(indent_level);
- System.out.println("}");
- }
+ this.currentScope.pop();
+ this.nested--;
}
@Override
public void enterElseBlock(MiniJavaParser.ElseBlockContext ctx) {
- tabPrint(indent_level);
- indent_level += 1;
- System.out.print("else");
- if (! ctx.getText().startsWith("{")) {
- System.out.println("{");
- }else{
- nestedBlockForStatement = true;
+ String name;
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ if(this.nested > 0){
+ name = "nested_else";
+ }
+ else {
+ name = "else";
}
+
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
+ this.nested++;
}
@Override
public void exitElseBlock(MiniJavaParser.ElseBlockContext ctx) {
- indent_level -= 1;
- if (! ctx.getText().endsWith("}")){
- tabPrint(indent_level);
- System.out.println("}");
- }
+ this.currentScope.pop();
+ this.nested--;
}
@Override
public void enterWhileBlock(MiniJavaParser.WhileBlockContext ctx) {
+ String name;
+ int parentId = this.currentScope.peek().id;
+ int line = ctx.getStart().getLine();
+ if(this.nested > 0){
+ name = "nested_while";
+ }
+ else {
+ name = "while";
+ }
+ SymbolTable table = new SymbolTable(name, id, parentId, line);
+ this.currentScope.push(table);
+ this.scopes.add(table);
+ this.nested++;
}
@Override
public void exitWhileBlock(MiniJavaParser.WhileBlockContext ctx) {
-
+ this.currentScope.pop();
+ this.nested--;
}
@Override
@@ -718,3 +764,51 @@ public void exitEveryRule(ParserRuleContext parserRuleContext) {
}
}
+
+
+class SymbolTable{
+ public String name;
+ public int id;
+ public int parentId;
+ public int line = 1;
+ public Map symbolTable;
+
+ public SymbolTable(String name, int id, int parentId){
+ this.symbolTable = new LinkedHashMap<>();
+ this.name = name;
+ this.id = id;
+ this.parentId = parentId;
+ }
+ public SymbolTable(String name, int id, int parentId, int line){
+ this.symbolTable = new LinkedHashMap<>();
+ this.name = name;
+ this.id = id;
+ this.parentId = parentId;
+ this.line = line;
+ }
+
+ public void print(){
+ System.out.println("-------------- " + this.name + ": " + this.line + " --------------");
+ if (!this.symbolTable.isEmpty()){
+ for(Map.Entry entry : this.symbolTable.entrySet()){
+ entry.getValue().print();
+ }
+ }
+ System.out.println("--------------------------------------------------------\n");
+
+ }
+}
+
+class SymbolTableEntry{
+ public String key;
+ public String value;
+ public SymbolTableEntry(String key, String value){
+ this.key = key;
+ this.value = value;
+ }
+
+ public void print(){
+ System.out.print(key + "\t|\t");
+ System.out.println(value);
+ }
+}
\ No newline at end of file
diff --git a/src/gen/MiniJavaBaseListener.java b/src/gen/MiniJavaBaseListener.java
index 44395c0..834caac 100644
--- a/src/gen/MiniJavaBaseListener.java
+++ b/src/gen/MiniJavaBaseListener.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
diff --git a/src/gen/MiniJavaBaseVisitor.java b/src/gen/MiniJavaBaseVisitor.java
index 186b12c..d0e6b5f 100644
--- a/src/gen/MiniJavaBaseVisitor.java
+++ b/src/gen/MiniJavaBaseVisitor.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
diff --git a/src/gen/MiniJavaLexer.java b/src/gen/MiniJavaLexer.java
index c0504da..2009a10 100644
--- a/src/gen/MiniJavaLexer.java
+++ b/src/gen/MiniJavaLexer.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
diff --git a/src/gen/MiniJavaListener.java b/src/gen/MiniJavaListener.java
index 036e94b..acdb99b 100644
--- a/src/gen/MiniJavaListener.java
+++ b/src/gen/MiniJavaListener.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
diff --git a/src/gen/MiniJavaParser.java b/src/gen/MiniJavaParser.java
index e18c004..5e77cab 100644
--- a/src/gen/MiniJavaParser.java
+++ b/src/gen/MiniJavaParser.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
@@ -349,7 +349,9 @@ public final MainMethodContext mainMethod() throws RecognitionException {
@SuppressWarnings("CheckReturnValue")
public static class ClassDeclarationContext extends ParserRuleContext {
public Token className;
+ public Token inherits;
public Token parentName;
+ public Token implements_;
public List Identifier() { return getTokens(MiniJavaParser.Identifier); }
public TerminalNode Identifier(int i) {
return getToken(MiniJavaParser.Identifier, i);
@@ -403,7 +405,7 @@ public final ClassDeclarationContext classDeclaration() throws RecognitionExcept
if (_la==T__7) {
{
setState(77);
- match(T__7);
+ ((ClassDeclarationContext)_localctx).inherits = match(T__7);
setState(78);
((ClassDeclarationContext)_localctx).parentName = match(Identifier);
}
@@ -415,7 +417,7 @@ public final ClassDeclarationContext classDeclaration() throws RecognitionExcept
if (_la==T__8) {
{
setState(81);
- match(T__8);
+ ((ClassDeclarationContext)_localctx).implements_ = match(T__8);
setState(82);
match(Identifier);
setState(87);
@@ -662,6 +664,7 @@ public final InterfaceMethodDeclarationContext interfaceMethodDeclaration() thro
@SuppressWarnings("CheckReturnValue")
public static class FieldDeclarationContext extends ParserRuleContext {
+ public Token final_;
public TypeContext type() {
return getRuleContext(TypeContext.class,0);
}
@@ -669,11 +672,11 @@ public TypeContext type() {
public AccessModifierContext accessModifier() {
return getRuleContext(AccessModifierContext.class,0);
}
- public TerminalNode Final() { return getToken(MiniJavaParser.Final, 0); }
public TerminalNode EQ() { return getToken(MiniJavaParser.EQ, 0); }
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
+ public TerminalNode Final() { return getToken(MiniJavaParser.Final, 0); }
public FieldDeclarationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@@ -716,7 +719,7 @@ public final FieldDeclarationContext fieldDeclaration() throws RecognitionExcept
if (_la==Final) {
{
setState(139);
- match(Final);
+ ((FieldDeclarationContext)_localctx).final_ = match(Final);
}
}
diff --git a/src/gen/MiniJavaVisitor.java b/src/gen/MiniJavaVisitor.java
index 4cbf1a3..b549acd 100644
--- a/src/gen/MiniJavaVisitor.java
+++ b/src/gen/MiniJavaVisitor.java
@@ -1,4 +1,4 @@
-package gen;// Generated from /home/yosef/Projects/CompilerFinalProject/grammar/MiniJava.g4 by ANTLR 4.13.1
+package gen;// Generated from /home/mmnb/Desktop/CompilerFinalProject-main/grammar/MiniJava.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**