diff --git a/src/main/java/Example.java b/src/main/java/Example.java
new file mode 100644
index 0000000..6f34d6e
--- /dev/null
+++ b/src/main/java/Example.java
@@ -0,0 +1,3 @@
+public class Example {
+}
+
diff --git a/src/main/java/parser/Main.java b/src/main/java/Main.java
similarity index 89%
rename from src/main/java/parser/Main.java
rename to src/main/java/Main.java
index b6a3855..ab4a4fe 100644
--- a/src/main/java/parser/Main.java
+++ b/src/main/java/Main.java
@@ -1,10 +1,11 @@
-package parser;
-
import bytecode.ByteCodeGenerator;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
+import parser.ASTBuilder;
+import parser.ClassDeclarationNode;
+import parser.ProgramNode;
import parser.generated.SimpleJavaLexer;
import parser.generated.SimpleJavaParser;
@@ -15,7 +16,7 @@ public class Main {
public static void main(String[] args) throws Exception {
CharStream codeCharStream = null;
try {
- codeCharStream = CharStreams.fromPath(Paths.get("path/to/your/file.txt"));
+ codeCharStream = CharStreams.fromPath(Paths.get("src/main/java/Example.java"));
parsefile(codeCharStream);
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
diff --git a/src/main/java/parser/ASTNode.java b/src/main/java/ast/ASTNode.java
similarity index 84%
rename from src/main/java/parser/ASTNode.java
rename to src/main/java/ast/ASTNode.java
index fad3ac0..7836a79 100644
--- a/src/main/java/parser/ASTNode.java
+++ b/src/main/java/ast/ASTNode.java
@@ -1,4 +1,4 @@
-package parser;
+package ast;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/ast/AccessModifier.java b/src/main/java/ast/AccessModifier.java
deleted file mode 100644
index 87a76de..0000000
--- a/src/main/java/ast/AccessModifier.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package ast;
-
-public enum AccessModifier {
- Public,Private
-}
diff --git a/src/main/java/ast/ClassDeclaration.java b/src/main/java/ast/ClassDeclaration.java
deleted file mode 100644
index abf46c9..0000000
--- a/src/main/java/ast/ClassDeclaration.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package ast;
-
-public abstract class ClassDeclaration {
- public AccessModifier accessModifier;
-
-
-}
diff --git a/src/main/java/ast/ClassNode.java b/src/main/java/ast/ClassNode.java
new file mode 100644
index 0000000..d9e2f04
--- /dev/null
+++ b/src/main/java/ast/ClassNode.java
@@ -0,0 +1,24 @@
+package ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ClassNode extends ASTNode{
+ public String name;
+ public List members = new ArrayList<>();
+ public boolean hasConstructor = false;
+
+ public void addMember(MemberNode member) {
+ if (member instanceof ConstructorNode) {
+ this.hasConstructor = true;
+ }
+ members.add(member);
+ }
+
+ public void ensureConstructor(){
+ if(!hasConstructor) {
+ ConstructorNode constructor = new ConstructorNode("public", name);
+ members.add(0,constructor);
+ }
+ }
+}
diff --git a/src/main/java/ast/ConstructorNode.java b/src/main/java/ast/ConstructorNode.java
new file mode 100644
index 0000000..21c73ea
--- /dev/null
+++ b/src/main/java/ast/ConstructorNode.java
@@ -0,0 +1,7 @@
+package ast;
+
+public class ConstructorNode extends MethodNode{
+ public ConstructorNode(String visibility, String name) {
+ super(visibility, name);
+ }
+}
diff --git a/src/main/java/ast/FieldNode.java b/src/main/java/ast/FieldNode.java
new file mode 100644
index 0000000..3bf6d2b
--- /dev/null
+++ b/src/main/java/ast/FieldNode.java
@@ -0,0 +1,12 @@
+package ast;
+
+public class FieldNode {
+ String type;
+ String name;
+
+ public FieldNode(String type, String name){
+ this.type = type;
+ this.name = name;
+ }
+
+}
diff --git a/src/main/java/ast/Identifier.java b/src/main/java/ast/Identifier.java
deleted file mode 100644
index fd15728..0000000
--- a/src/main/java/ast/Identifier.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package ast;
-
-public class Identifier {
- private String name;
-
- public Identifier(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-}
diff --git a/src/main/java/ast/MemberNode.java b/src/main/java/ast/MemberNode.java
new file mode 100644
index 0000000..c1086cd
--- /dev/null
+++ b/src/main/java/ast/MemberNode.java
@@ -0,0 +1,4 @@
+package ast;
+
+public class MemberNode extends ASTNode{
+}
diff --git a/src/main/java/ast/MethodNode.java b/src/main/java/ast/MethodNode.java
new file mode 100644
index 0000000..b9a8ab4
--- /dev/null
+++ b/src/main/java/ast/MethodNode.java
@@ -0,0 +1,11 @@
+package ast;
+
+public class MethodNode extends MemberNode{
+ public String visibility;
+ public String name;
+
+ public MethodNode(String visibility, String name){
+ this.visibility = visibility;
+ this.name = name;
+ }
+}
diff --git a/src/main/java/ast/ProgramNode.java b/src/main/java/ast/ProgramNode.java
new file mode 100644
index 0000000..d22af33
--- /dev/null
+++ b/src/main/java/ast/ProgramNode.java
@@ -0,0 +1,12 @@
+package ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProgramNode extends ASTNode {
+ public List classes = new ArrayList<>();
+
+ public void addClass(ClassNode classNode) {
+ classes.add(classNode);
+ }
+}
diff --git a/src/main/java/ast/Type.java b/src/main/java/ast/Type.java
deleted file mode 100644
index c412781..0000000
--- a/src/main/java/ast/Type.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package ast;
-
-public interface Type {
-
-}
-
-
diff --git a/src/main/java/ast/TypeNode.java b/src/main/java/ast/TypeNode.java
new file mode 100644
index 0000000..1f657df
--- /dev/null
+++ b/src/main/java/ast/TypeNode.java
@@ -0,0 +1,5 @@
+package ast;
+
+public class TypeNode {
+ String type;
+}
diff --git a/src/main/java/bytecode/ByteCodeGenerator.java b/src/main/java/bytecode/ByteCodeGenerator.java
index aa0a117..b00f429 100644
--- a/src/main/java/bytecode/ByteCodeGenerator.java
+++ b/src/main/java/bytecode/ByteCodeGenerator.java
@@ -5,8 +5,7 @@ import java.io.IOException;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
-import parser.ClassDeclarationNode;
-import parser.ProgramNode;
+import ast.ProgramNode;
public class ByteCodeGenerator {
diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java
index ccf3ba7..fe0bdeb 100644
--- a/src/main/java/parser/ASTBuilder.java
+++ b/src/main/java/parser/ASTBuilder.java
@@ -1,5 +1,6 @@
package parser;
+import ast.*;
import parser.generated.SimpleJavaBaseVisitor;
import parser.generated.SimpleJavaParser;
@@ -8,13 +9,28 @@ public class ASTBuilder extends SimpleJavaBaseVisitor {
public ASTNode visitProgram(SimpleJavaParser.ProgramContext ctx) {
ProgramNode program = new ProgramNode();
for (SimpleJavaParser.ClassDeclarationContext classDeclCtx : ctx.classDeclaration()) {
- program.addClass((ClassDeclarationNode) visit(classDeclCtx));
+ program.addClass((ClassNode) visit(classDeclCtx));
}
return program;
}
@Override
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
- return new ClassDeclarationNode(ctx.IDENTIFIER().getText());
+ ClassNode classNode = new ClassNode();
+ classNode.name = ctx.IDENTIFIER().getText();
+ for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
+ classNode.addMember((MemberNode) visit(member));
+ }
+ classNode.ensureConstructor(); // Check and add default constructor if needed
+ return classNode;
}
+
+ @Override
+ public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) {
+ TypeNode type = (TypeNode) visit(ctx.type());
+ String identifier = ctx.IDENTIFIER().getText();
+ return new FieldNode(type, identifier);
+ }
+
+
}
diff --git a/src/main/java/parser/ClassDeclarationNode.java b/src/main/java/parser/ClassDeclarationNode.java
deleted file mode 100644
index e6798fa..0000000
--- a/src/main/java/parser/ClassDeclarationNode.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package parser;
-
-import parser.ASTNode;
-
-public class ClassDeclarationNode extends ASTNode {
- public String identifier;
-
- public ClassDeclarationNode(String identifier) {
- this.identifier = identifier;
- }
-}
diff --git a/src/main/java/parser/ProgramNode.java b/src/main/java/parser/ProgramNode.java
deleted file mode 100644
index 2b54468..0000000
--- a/src/main/java/parser/ProgramNode.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package parser;
-
-import parser.ASTNode;
-import parser.ClassDeclarationNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProgramNode extends ASTNode {
- public List classes = new ArrayList<>();
-
- public void addClass(ClassDeclarationNode classNode) {
- classes.add(classNode);
- }
-}
diff --git a/src/main/java/parser/SimpleJava.g4 b/src/main/java/parser/SimpleJava.g4
index b0779c7..122da44 100644
--- a/src/main/java/parser/SimpleJava.g4
+++ b/src/main/java/parser/SimpleJava.g4
@@ -2,8 +2,56 @@ grammar SimpleJava;
program : classDeclaration+;
-classDeclaration : 'class' IDENTIFIER '{' '}';
+classDeclaration : 'class' IDENTIFIER '{' memberDeclaration* '}';
-IDENTIFIER : [a-zA-Z][a-zA-Z0-9_]*;
+memberDeclaration : fieldDeclaration | methodDeclaration;
+
+fieldDeclaration : type IDENTIFIER ';';
+
+methodDeclaration : 'public' 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
+
+parameterList : parameter (',' parameter)* ;
+parameter : type IDENTIFIER ;
+
+type : 'int' | 'boolean' | 'char' ;
+
+statement
+ : variableDeclarationStatement
+ | assignmentStatement
+ | ifStatement
+ | whileStatement
+ | returnStatement
+ | block
+ ;
+
+variableDeclarationStatement : type IDENTIFIER ('=' expression)? ';' ;
+
+assignmentStatement : IDENTIFIER '=' expression ';' ;
+
+ifStatement : 'if' '(' expression ')' statement ('else' statement)? ;
+
+whileStatement : 'while' '(' expression ')' statement ;
+
+returnStatement : 'return' (expression)? ';' ;
+
+block : '{' statement* '}' ;
+
+expression
+ : expression ('&&' | '||') expression
+ | expression ('==' | '!=' | '<' | '<=' | '>' | '>=') expression
+ | expression ('+' | '-' | '*' | '/' | '%') expression
+ | '-' expression
+ | '!' expression
+ | '(' expression ')'
+ | literal
+ | IDENTIFIER
+ ;
+
+literal : INTEGERLITERAL | booleanLiteral | charLiteral ;
+
+INTEGERLITERAL : [0-9]+ ;
+booleanLiteral : 'true' | 'false' ;
+charLiteral : '\'' . '\'' ;
+IDENTIFIER : [a-zA-Z][a-zA-Z0-9_]* ;
WS : [ \t\r\n]+ -> skip;
\ No newline at end of file
diff --git a/src/main/java/parser/Test.txt b/src/main/java/parser/Test.txt
deleted file mode 100644
index 5a0c977..0000000
--- a/src/main/java/parser/Test.txt
+++ /dev/null
@@ -1 +0,0 @@
-class Test { }
\ No newline at end of file
diff --git a/src/main/java/parser/generated/SimpleJava.interp b/src/main/java/parser/generated/SimpleJava.interp
index 5754367..2e4f97b 100644
--- a/src/main/java/parser/generated/SimpleJava.interp
+++ b/src/main/java/parser/generated/SimpleJava.interp
@@ -3,6 +3,38 @@ null
'class'
'{'
'}'
+';'
+'public'
+'static'
+'('
+')'
+','
+'int'
+'boolean'
+'char'
+'='
+'if'
+'else'
+'while'
+'return'
+'&&'
+'||'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'/'
+'%'
+'!'
+'true'
+'false'
+'\''
+null
null
null
@@ -11,13 +43,62 @@ null
null
null
null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+INTEGERLITERAL
IDENTIFIER
WS
rule names:
program
classDeclaration
+memberDeclaration
+fieldDeclaration
+methodDeclaration
+parameterList
+parameter
+type
+statement
+variableDeclarationStatement
+assignmentStatement
+ifStatement
+whileStatement
+returnStatement
+block
+expression
+literal
+booleanLiteral
+charLiteral
atn:
-[4, 1, 5, 15, 2, 0, 7, 0, 2, 1, 7, 1, 1, 0, 4, 0, 6, 8, 0, 11, 0, 12, 0, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 0, 2, 0, 0, 13, 0, 5, 1, 0, 0, 0, 2, 9, 1, 0, 0, 0, 4, 6, 3, 2, 1, 0, 5, 4, 1, 0, 0, 0, 6, 7, 1, 0, 0, 0, 7, 5, 1, 0, 0, 0, 7, 8, 1, 0, 0, 0, 8, 1, 1, 0, 0, 0, 9, 10, 5, 1, 0, 0, 10, 11, 5, 4, 0, 0, 11, 12, 5, 2, 0, 0, 12, 13, 5, 3, 0, 0, 13, 3, 1, 0, 0, 0, 1, 7]
\ No newline at end of file
+[4, 1, 37, 183, 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, 1, 0, 4, 0, 40, 8, 0, 11, 0, 12, 0, 41, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 48, 8, 1, 10, 1, 12, 1, 51, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 2, 57, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 69, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 74, 8, 4, 10, 4, 12, 4, 77, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 84, 8, 5, 10, 5, 12, 5, 87, 9, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 100, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 106, 8, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 122, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 3, 13, 132, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 5, 14, 138, 8, 14, 10, 14, 12, 14, 141, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 156, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 167, 8, 15, 10, 15, 12, 15, 170, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 175, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 0, 1, 30, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 5, 1, 0, 10, 12, 1, 0, 18, 19, 1, 0, 20, 25, 1, 0, 26, 30, 1, 0, 32, 33, 187, 0, 39, 1, 0, 0, 0, 2, 43, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 58, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 80, 1, 0, 0, 0, 12, 88, 1, 0, 0, 0, 14, 91, 1, 0, 0, 0, 16, 99, 1, 0, 0, 0, 18, 101, 1, 0, 0, 0, 20, 109, 1, 0, 0, 0, 22, 114, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 129, 1, 0, 0, 0, 28, 135, 1, 0, 0, 0, 30, 155, 1, 0, 0, 0, 32, 174, 1, 0, 0, 0, 34, 176, 1, 0, 0, 0, 36, 178, 1, 0, 0, 0, 38, 40, 3, 2, 1, 0, 39, 38, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 1, 1, 0, 0, 0, 43, 44, 5, 1, 0, 0, 44, 45, 5, 36, 0, 0, 45, 49, 5, 2, 0, 0, 46, 48, 3, 4, 2, 0, 47, 46, 1, 0, 0, 0, 48, 51, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 52, 53, 5, 3, 0, 0, 53, 3, 1, 0, 0, 0, 54, 57, 3, 6, 3, 0, 55, 57, 3, 8, 4, 0, 56, 54, 1, 0, 0, 0, 56, 55, 1, 0, 0, 0, 57, 5, 1, 0, 0, 0, 58, 59, 3, 14, 7, 0, 59, 60, 5, 36, 0, 0, 60, 61, 5, 4, 0, 0, 61, 7, 1, 0, 0, 0, 62, 63, 5, 5, 0, 0, 63, 64, 5, 6, 0, 0, 64, 65, 3, 14, 7, 0, 65, 66, 5, 36, 0, 0, 66, 68, 5, 7, 0, 0, 67, 69, 3, 10, 5, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 5, 8, 0, 0, 71, 75, 5, 2, 0, 0, 72, 74, 3, 16, 8, 0, 73, 72, 1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 78, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 79, 5, 3, 0, 0, 79, 9, 1, 0, 0, 0, 80, 85, 3, 12, 6, 0, 81, 82, 5, 9, 0, 0, 82, 84, 3, 12, 6, 0, 83, 81, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 11, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 88, 89, 3, 14, 7, 0, 89, 90, 5, 36, 0, 0, 90, 13, 1, 0, 0, 0, 91, 92, 7, 0, 0, 0, 92, 15, 1, 0, 0, 0, 93, 100, 3, 18, 9, 0, 94, 100, 3, 20, 10, 0, 95, 100, 3, 22, 11, 0, 96, 100, 3, 24, 12, 0, 97, 100, 3, 26, 13, 0, 98, 100, 3, 28, 14, 0, 99, 93, 1, 0, 0, 0, 99, 94, 1, 0, 0, 0, 99, 95, 1, 0, 0, 0, 99, 96, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 98, 1, 0, 0, 0, 100, 17, 1, 0, 0, 0, 101, 102, 3, 14, 7, 0, 102, 105, 5, 36, 0, 0, 103, 104, 5, 13, 0, 0, 104, 106, 3, 30, 15, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 108, 5, 4, 0, 0, 108, 19, 1, 0, 0, 0, 109, 110, 5, 36, 0, 0, 110, 111, 5, 13, 0, 0, 111, 112, 3, 30, 15, 0, 112, 113, 5, 4, 0, 0, 113, 21, 1, 0, 0, 0, 114, 115, 5, 14, 0, 0, 115, 116, 5, 7, 0, 0, 116, 117, 3, 30, 15, 0, 117, 118, 5, 8, 0, 0, 118, 121, 3, 16, 8, 0, 119, 120, 5, 15, 0, 0, 120, 122, 3, 16, 8, 0, 121, 119, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 122, 23, 1, 0, 0, 0, 123, 124, 5, 16, 0, 0, 124, 125, 5, 7, 0, 0, 125, 126, 3, 30, 15, 0, 126, 127, 5, 8, 0, 0, 127, 128, 3, 16, 8, 0, 128, 25, 1, 0, 0, 0, 129, 131, 5, 17, 0, 0, 130, 132, 3, 30, 15, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 5, 4, 0, 0, 134, 27, 1, 0, 0, 0, 135, 139, 5, 2, 0, 0, 136, 138, 3, 16, 8, 0, 137, 136, 1, 0, 0, 0, 138, 141, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 142, 1, 0, 0, 0, 141, 139, 1, 0, 0, 0, 142, 143, 5, 3, 0, 0, 143, 29, 1, 0, 0, 0, 144, 145, 6, 15, -1, 0, 145, 146, 5, 27, 0, 0, 146, 156, 3, 30, 15, 5, 147, 148, 5, 31, 0, 0, 148, 156, 3, 30, 15, 4, 149, 150, 5, 7, 0, 0, 150, 151, 3, 30, 15, 0, 151, 152, 5, 8, 0, 0, 152, 156, 1, 0, 0, 0, 153, 156, 3, 32, 16, 0, 154, 156, 5, 36, 0, 0, 155, 144, 1, 0, 0, 0, 155, 147, 1, 0, 0, 0, 155, 149, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 154, 1, 0, 0, 0, 156, 168, 1, 0, 0, 0, 157, 158, 10, 8, 0, 0, 158, 159, 7, 1, 0, 0, 159, 167, 3, 30, 15, 9, 160, 161, 10, 7, 0, 0, 161, 162, 7, 2, 0, 0, 162, 167, 3, 30, 15, 8, 163, 164, 10, 6, 0, 0, 164, 165, 7, 3, 0, 0, 165, 167, 3, 30, 15, 7, 166, 157, 1, 0, 0, 0, 166, 160, 1, 0, 0, 0, 166, 163, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 31, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 175, 5, 35, 0, 0, 172, 175, 3, 34, 17, 0, 173, 175, 3, 36, 18, 0, 174, 171, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 173, 1, 0, 0, 0, 175, 33, 1, 0, 0, 0, 176, 177, 7, 4, 0, 0, 177, 35, 1, 0, 0, 0, 178, 179, 5, 34, 0, 0, 179, 180, 9, 0, 0, 0, 180, 181, 5, 34, 0, 0, 181, 37, 1, 0, 0, 0, 15, 41, 49, 56, 68, 75, 85, 99, 105, 121, 131, 139, 155, 166, 168, 174]
\ No newline at end of file
diff --git a/src/main/java/parser/generated/SimpleJava.tokens b/src/main/java/parser/generated/SimpleJava.tokens
index d009d79..d96b83f 100644
--- a/src/main/java/parser/generated/SimpleJava.tokens
+++ b/src/main/java/parser/generated/SimpleJava.tokens
@@ -1,8 +1,71 @@
T__0=1
T__1=2
T__2=3
-IDENTIFIER=4
-WS=5
+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
+T__22=23
+T__23=24
+T__24=25
+T__25=26
+T__26=27
+T__27=28
+T__28=29
+T__29=30
+T__30=31
+T__31=32
+T__32=33
+T__33=34
+INTEGERLITERAL=35
+IDENTIFIER=36
+WS=37
'class'=1
'{'=2
'}'=3
+';'=4
+'public'=5
+'static'=6
+'('=7
+')'=8
+','=9
+'int'=10
+'boolean'=11
+'char'=12
+'='=13
+'if'=14
+'else'=15
+'while'=16
+'return'=17
+'&&'=18
+'||'=19
+'=='=20
+'!='=21
+'<'=22
+'<='=23
+'>'=24
+'>='=25
+'+'=26
+'-'=27
+'*'=28
+'/'=29
+'%'=30
+'!'=31
+'true'=32
+'false'=33
+'\''=34
diff --git a/src/main/java/parser/generated/SimpleJavaBaseListener.java b/src/main/java/parser/generated/SimpleJavaBaseListener.java
index 357529f..6458396 100644
--- a/src/main/java/parser/generated/SimpleJavaBaseListener.java
+++ b/src/main/java/parser/generated/SimpleJavaBaseListener.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.ParserRuleContext;
@@ -36,6 +36,210 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
* The default implementation does nothing.
*/
@Override public void exitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterParameterList(SimpleJavaParser.ParameterListContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitParameterList(SimpleJavaParser.ParameterListContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterParameter(SimpleJavaParser.ParameterContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitParameter(SimpleJavaParser.ParameterContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterType(SimpleJavaParser.TypeContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitType(SimpleJavaParser.TypeContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterStatement(SimpleJavaParser.StatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitStatement(SimpleJavaParser.StatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterReturnStatement(SimpleJavaParser.ReturnStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterBlock(SimpleJavaParser.BlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitBlock(SimpleJavaParser.BlockContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterExpression(SimpleJavaParser.ExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitExpression(SimpleJavaParser.ExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLiteral(SimpleJavaParser.LiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLiteral(SimpleJavaParser.LiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { }
/**
* {@inheritDoc}
diff --git a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java
index 3f44819..bb44046 100644
--- a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java
+++ b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
@@ -26,4 +26,123 @@ public class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implem
* {@link #visitChildren} on {@code ctx}.
*/
@Override public T visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitParameterList(SimpleJavaParser.ParameterListContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitParameter(SimpleJavaParser.ParameterContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitType(SimpleJavaParser.TypeContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitStatement(SimpleJavaParser.StatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitIfStatement(SimpleJavaParser.IfStatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitBlock(SimpleJavaParser.BlockContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitExpression(SimpleJavaParser.ExpressionContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitLiteral(SimpleJavaParser.LiteralContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { return visitChildren(ctx); }
}
\ No newline at end of file
diff --git a/src/main/java/parser/generated/SimpleJavaLexer.interp b/src/main/java/parser/generated/SimpleJavaLexer.interp
index 7e306ab..b0c00d2 100644
--- a/src/main/java/parser/generated/SimpleJavaLexer.interp
+++ b/src/main/java/parser/generated/SimpleJavaLexer.interp
@@ -3,6 +3,38 @@ null
'class'
'{'
'}'
+';'
+'public'
+'static'
+'('
+')'
+','
+'int'
+'boolean'
+'char'
+'='
+'if'
+'else'
+'while'
+'return'
+'&&'
+'||'
+'=='
+'!='
+'<'
+'<='
+'>'
+'>='
+'+'
+'-'
+'*'
+'/'
+'%'
+'!'
+'true'
+'false'
+'\''
+null
null
null
@@ -11,6 +43,38 @@ null
null
null
null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+INTEGERLITERAL
IDENTIFIER
WS
@@ -18,6 +82,38 @@ 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
+T__22
+T__23
+T__24
+T__25
+T__26
+T__27
+T__28
+T__29
+T__30
+T__31
+T__32
+T__33
+INTEGERLITERAL
IDENTIFIER
WS
@@ -29,4 +125,4 @@ mode names:
DEFAULT_MODE
atn:
-[4, 0, 5, 35, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 5, 3, 24, 8, 3, 10, 3, 12, 3, 27, 9, 3, 1, 4, 4, 4, 30, 8, 4, 11, 4, 12, 4, 31, 1, 4, 1, 4, 0, 0, 5, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 1, 0, 3, 2, 0, 65, 90, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 36, 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, 1, 11, 1, 0, 0, 0, 3, 17, 1, 0, 0, 0, 5, 19, 1, 0, 0, 0, 7, 21, 1, 0, 0, 0, 9, 29, 1, 0, 0, 0, 11, 12, 5, 99, 0, 0, 12, 13, 5, 108, 0, 0, 13, 14, 5, 97, 0, 0, 14, 15, 5, 115, 0, 0, 15, 16, 5, 115, 0, 0, 16, 2, 1, 0, 0, 0, 17, 18, 5, 123, 0, 0, 18, 4, 1, 0, 0, 0, 19, 20, 5, 125, 0, 0, 20, 6, 1, 0, 0, 0, 21, 25, 7, 0, 0, 0, 22, 24, 7, 1, 0, 0, 23, 22, 1, 0, 0, 0, 24, 27, 1, 0, 0, 0, 25, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 8, 1, 0, 0, 0, 27, 25, 1, 0, 0, 0, 28, 30, 7, 2, 0, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 33, 1, 0, 0, 0, 33, 34, 6, 4, 0, 0, 34, 10, 1, 0, 0, 0, 3, 0, 25, 31, 1, 6, 0, 0]
\ No newline at end of file
+[4, 0, 37, 213, 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, 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, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 4, 34, 196, 8, 34, 11, 34, 12, 34, 197, 1, 35, 1, 35, 5, 35, 202, 8, 35, 10, 35, 12, 35, 205, 9, 35, 1, 36, 4, 36, 208, 8, 36, 11, 36, 12, 36, 209, 1, 36, 1, 36, 0, 0, 37, 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, 1, 0, 4, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 215, 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, 1, 75, 1, 0, 0, 0, 3, 81, 1, 0, 0, 0, 5, 83, 1, 0, 0, 0, 7, 85, 1, 0, 0, 0, 9, 87, 1, 0, 0, 0, 11, 94, 1, 0, 0, 0, 13, 101, 1, 0, 0, 0, 15, 103, 1, 0, 0, 0, 17, 105, 1, 0, 0, 0, 19, 107, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, 124, 1, 0, 0, 0, 27, 126, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 134, 1, 0, 0, 0, 33, 140, 1, 0, 0, 0, 35, 147, 1, 0, 0, 0, 37, 150, 1, 0, 0, 0, 39, 153, 1, 0, 0, 0, 41, 156, 1, 0, 0, 0, 43, 159, 1, 0, 0, 0, 45, 161, 1, 0, 0, 0, 47, 164, 1, 0, 0, 0, 49, 166, 1, 0, 0, 0, 51, 169, 1, 0, 0, 0, 53, 171, 1, 0, 0, 0, 55, 173, 1, 0, 0, 0, 57, 175, 1, 0, 0, 0, 59, 177, 1, 0, 0, 0, 61, 179, 1, 0, 0, 0, 63, 181, 1, 0, 0, 0, 65, 186, 1, 0, 0, 0, 67, 192, 1, 0, 0, 0, 69, 195, 1, 0, 0, 0, 71, 199, 1, 0, 0, 0, 73, 207, 1, 0, 0, 0, 75, 76, 5, 99, 0, 0, 76, 77, 5, 108, 0, 0, 77, 78, 5, 97, 0, 0, 78, 79, 5, 115, 0, 0, 79, 80, 5, 115, 0, 0, 80, 2, 1, 0, 0, 0, 81, 82, 5, 123, 0, 0, 82, 4, 1, 0, 0, 0, 83, 84, 5, 125, 0, 0, 84, 6, 1, 0, 0, 0, 85, 86, 5, 59, 0, 0, 86, 8, 1, 0, 0, 0, 87, 88, 5, 112, 0, 0, 88, 89, 5, 117, 0, 0, 89, 90, 5, 98, 0, 0, 90, 91, 5, 108, 0, 0, 91, 92, 5, 105, 0, 0, 92, 93, 5, 99, 0, 0, 93, 10, 1, 0, 0, 0, 94, 95, 5, 115, 0, 0, 95, 96, 5, 116, 0, 0, 96, 97, 5, 97, 0, 0, 97, 98, 5, 116, 0, 0, 98, 99, 5, 105, 0, 0, 99, 100, 5, 99, 0, 0, 100, 12, 1, 0, 0, 0, 101, 102, 5, 40, 0, 0, 102, 14, 1, 0, 0, 0, 103, 104, 5, 41, 0, 0, 104, 16, 1, 0, 0, 0, 105, 106, 5, 44, 0, 0, 106, 18, 1, 0, 0, 0, 107, 108, 5, 105, 0, 0, 108, 109, 5, 110, 0, 0, 109, 110, 5, 116, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 98, 0, 0, 112, 113, 5, 111, 0, 0, 113, 114, 5, 111, 0, 0, 114, 115, 5, 108, 0, 0, 115, 116, 5, 101, 0, 0, 116, 117, 5, 97, 0, 0, 117, 118, 5, 110, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 99, 0, 0, 120, 121, 5, 104, 0, 0, 121, 122, 5, 97, 0, 0, 122, 123, 5, 114, 0, 0, 123, 24, 1, 0, 0, 0, 124, 125, 5, 61, 0, 0, 125, 26, 1, 0, 0, 0, 126, 127, 5, 105, 0, 0, 127, 128, 5, 102, 0, 0, 128, 28, 1, 0, 0, 0, 129, 130, 5, 101, 0, 0, 130, 131, 5, 108, 0, 0, 131, 132, 5, 115, 0, 0, 132, 133, 5, 101, 0, 0, 133, 30, 1, 0, 0, 0, 134, 135, 5, 119, 0, 0, 135, 136, 5, 104, 0, 0, 136, 137, 5, 105, 0, 0, 137, 138, 5, 108, 0, 0, 138, 139, 5, 101, 0, 0, 139, 32, 1, 0, 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 101, 0, 0, 142, 143, 5, 116, 0, 0, 143, 144, 5, 117, 0, 0, 144, 145, 5, 114, 0, 0, 145, 146, 5, 110, 0, 0, 146, 34, 1, 0, 0, 0, 147, 148, 5, 38, 0, 0, 148, 149, 5, 38, 0, 0, 149, 36, 1, 0, 0, 0, 150, 151, 5, 124, 0, 0, 151, 152, 5, 124, 0, 0, 152, 38, 1, 0, 0, 0, 153, 154, 5, 61, 0, 0, 154, 155, 5, 61, 0, 0, 155, 40, 1, 0, 0, 0, 156, 157, 5, 33, 0, 0, 157, 158, 5, 61, 0, 0, 158, 42, 1, 0, 0, 0, 159, 160, 5, 60, 0, 0, 160, 44, 1, 0, 0, 0, 161, 162, 5, 60, 0, 0, 162, 163, 5, 61, 0, 0, 163, 46, 1, 0, 0, 0, 164, 165, 5, 62, 0, 0, 165, 48, 1, 0, 0, 0, 166, 167, 5, 62, 0, 0, 167, 168, 5, 61, 0, 0, 168, 50, 1, 0, 0, 0, 169, 170, 5, 43, 0, 0, 170, 52, 1, 0, 0, 0, 171, 172, 5, 45, 0, 0, 172, 54, 1, 0, 0, 0, 173, 174, 5, 42, 0, 0, 174, 56, 1, 0, 0, 0, 175, 176, 5, 47, 0, 0, 176, 58, 1, 0, 0, 0, 177, 178, 5, 37, 0, 0, 178, 60, 1, 0, 0, 0, 179, 180, 5, 33, 0, 0, 180, 62, 1, 0, 0, 0, 181, 182, 5, 116, 0, 0, 182, 183, 5, 114, 0, 0, 183, 184, 5, 117, 0, 0, 184, 185, 5, 101, 0, 0, 185, 64, 1, 0, 0, 0, 186, 187, 5, 102, 0, 0, 187, 188, 5, 97, 0, 0, 188, 189, 5, 108, 0, 0, 189, 190, 5, 115, 0, 0, 190, 191, 5, 101, 0, 0, 191, 66, 1, 0, 0, 0, 192, 193, 5, 39, 0, 0, 193, 68, 1, 0, 0, 0, 194, 196, 7, 0, 0, 0, 195, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 70, 1, 0, 0, 0, 199, 203, 7, 1, 0, 0, 200, 202, 7, 2, 0, 0, 201, 200, 1, 0, 0, 0, 202, 205, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 72, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 206, 208, 7, 3, 0, 0, 207, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 6, 36, 0, 0, 212, 74, 1, 0, 0, 0, 4, 0, 197, 203, 209, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/src/main/java/parser/generated/SimpleJavaLexer.java b/src/main/java/parser/generated/SimpleJavaLexer.java
index 37dda97..8ed896a 100644
--- a/src/main/java/parser/generated/SimpleJavaLexer.java
+++ b/src/main/java/parser/generated/SimpleJavaLexer.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
@@ -17,7 +17,11 @@ public class SimpleJavaLexer extends Lexer {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__0=1, T__1=2, T__2=3, IDENTIFIER=4, WS=5;
+ 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, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, INTEGERLITERAL=35, IDENTIFIER=36, WS=37;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
@@ -28,20 +32,31 @@ public class SimpleJavaLexer extends Lexer {
private static String[] makeRuleNames() {
return new String[] {
- "T__0", "T__1", "T__2", "IDENTIFIER", "WS"
+ "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", "T__22", "T__23", "T__24",
+ "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
+ "T__33", "INTEGERLITERAL", "IDENTIFIER", "WS"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
- null, "'class'", "'{'", "'}'"
+ null, "'class'", "'{'", "'}'", "';'", "'public'", "'static'", "'('",
+ "')'", "','", "'int'", "'boolean'", "'char'", "'='", "'if'", "'else'",
+ "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", "'<='",
+ "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", "'false'",
+ "'''"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
- null, null, null, null, "IDENTIFIER", "WS"
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, "INTEGERLITERAL",
+ "IDENTIFIER", "WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -103,32 +118,134 @@ public class SimpleJavaLexer extends Lexer {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
- "\u0004\u0000\u0005#\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
+ "\u0004\u0000%\u00d5\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
- "\u0007\u0004\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000"+
- "\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003"+
- "\u0001\u0003\u0005\u0003\u0018\b\u0003\n\u0003\f\u0003\u001b\t\u0003\u0001"+
- "\u0004\u0004\u0004\u001e\b\u0004\u000b\u0004\f\u0004\u001f\u0001\u0004"+
- "\u0001\u0004\u0000\u0000\u0005\u0001\u0001\u0003\u0002\u0005\u0003\u0007"+
- "\u0004\t\u0005\u0001\u0000\u0003\u0002\u0000AZaz\u0004\u000009AZ__az\u0003"+
- "\u0000\t\n\r\r $\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+
- "\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+
- "\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0001\u000b\u0001\u0000"+
- "\u0000\u0000\u0003\u0011\u0001\u0000\u0000\u0000\u0005\u0013\u0001\u0000"+
- "\u0000\u0000\u0007\u0015\u0001\u0000\u0000\u0000\t\u001d\u0001\u0000\u0000"+
- "\u0000\u000b\f\u0005c\u0000\u0000\f\r\u0005l\u0000\u0000\r\u000e\u0005"+
- "a\u0000\u0000\u000e\u000f\u0005s\u0000\u0000\u000f\u0010\u0005s\u0000"+
- "\u0000\u0010\u0002\u0001\u0000\u0000\u0000\u0011\u0012\u0005{\u0000\u0000"+
- "\u0012\u0004\u0001\u0000\u0000\u0000\u0013\u0014\u0005}\u0000\u0000\u0014"+
- "\u0006\u0001\u0000\u0000\u0000\u0015\u0019\u0007\u0000\u0000\u0000\u0016"+
- "\u0018\u0007\u0001\u0000\u0000\u0017\u0016\u0001\u0000\u0000\u0000\u0018"+
- "\u001b\u0001\u0000\u0000\u0000\u0019\u0017\u0001\u0000\u0000\u0000\u0019"+
- "\u001a\u0001\u0000\u0000\u0000\u001a\b\u0001\u0000\u0000\u0000\u001b\u0019"+
- "\u0001\u0000\u0000\u0000\u001c\u001e\u0007\u0002\u0000\u0000\u001d\u001c"+
- "\u0001\u0000\u0000\u0000\u001e\u001f\u0001\u0000\u0000\u0000\u001f\u001d"+
- "\u0001\u0000\u0000\u0000\u001f \u0001\u0000\u0000\u0000 !\u0001\u0000"+
- "\u0000\u0000!\"\u0006\u0004\u0000\u0000\"\n\u0001\u0000\u0000\u0000\u0003"+
- "\u0000\u0019\u001f\u0001\u0006\u0000\u0000";
+ "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
+ "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
+ "\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+
+ "\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+
+ "\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+
+ "\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+
+ "\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
+ "\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
+ "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
+ "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0001\u0000\u0001\u0000"+
+ "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001"+
+ "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+
+ "\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005"+
+ "\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+
+ "\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001"+
+ "\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+
+ "\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+
+ "\u000b\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e"+
+ "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f"+
+ "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010"+
+ "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+
+ "\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013"+
+ "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+
+ "\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0018"+
+ "\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a"+
+ "\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d"+
+ "\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f"+
+ "\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001"+
+ "\"\u0004\"\u00c4\b\"\u000b\"\f\"\u00c5\u0001#\u0001#\u0005#\u00ca\b#\n"+
+ "#\f#\u00cd\t#\u0001$\u0004$\u00d0\b$\u000b$\f$\u00d1\u0001$\u0001$\u0000"+
+ "\u0000%\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b"+
+ "\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b"+
+ "\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016"+
+ "-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\""+
+ "E#G$I%\u0001\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009A"+
+ "Z__az\u0003\u0000\t\n\r\r \u00d7\u0000\u0001\u0001\u0000\u0000\u0000"+
+ "\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000"+
+ "\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000"+
+ "\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f"+
+ "\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013"+
+ "\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017"+
+ "\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b"+
+ "\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f"+
+ "\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000"+
+ "\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000"+
+ "\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000"+
+ "-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001"+
+ "\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000"+
+ "\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000"+
+ ";\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001"+
+ "\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000"+
+ "\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000"+
+ "I\u0001\u0000\u0000\u0000\u0001K\u0001\u0000\u0000\u0000\u0003Q\u0001"+
+ "\u0000\u0000\u0000\u0005S\u0001\u0000\u0000\u0000\u0007U\u0001\u0000\u0000"+
+ "\u0000\tW\u0001\u0000\u0000\u0000\u000b^\u0001\u0000\u0000\u0000\re\u0001"+
+ "\u0000\u0000\u0000\u000fg\u0001\u0000\u0000\u0000\u0011i\u0001\u0000\u0000"+
+ "\u0000\u0013k\u0001\u0000\u0000\u0000\u0015o\u0001\u0000\u0000\u0000\u0017"+
+ "w\u0001\u0000\u0000\u0000\u0019|\u0001\u0000\u0000\u0000\u001b~\u0001"+
+ "\u0000\u0000\u0000\u001d\u0081\u0001\u0000\u0000\u0000\u001f\u0086\u0001"+
+ "\u0000\u0000\u0000!\u008c\u0001\u0000\u0000\u0000#\u0093\u0001\u0000\u0000"+
+ "\u0000%\u0096\u0001\u0000\u0000\u0000\'\u0099\u0001\u0000\u0000\u0000"+
+ ")\u009c\u0001\u0000\u0000\u0000+\u009f\u0001\u0000\u0000\u0000-\u00a1"+
+ "\u0001\u0000\u0000\u0000/\u00a4\u0001\u0000\u0000\u00001\u00a6\u0001\u0000"+
+ "\u0000\u00003\u00a9\u0001\u0000\u0000\u00005\u00ab\u0001\u0000\u0000\u0000"+
+ "7\u00ad\u0001\u0000\u0000\u00009\u00af\u0001\u0000\u0000\u0000;\u00b1"+
+ "\u0001\u0000\u0000\u0000=\u00b3\u0001\u0000\u0000\u0000?\u00b5\u0001\u0000"+
+ "\u0000\u0000A\u00ba\u0001\u0000\u0000\u0000C\u00c0\u0001\u0000\u0000\u0000"+
+ "E\u00c3\u0001\u0000\u0000\u0000G\u00c7\u0001\u0000\u0000\u0000I\u00cf"+
+ "\u0001\u0000\u0000\u0000KL\u0005c\u0000\u0000LM\u0005l\u0000\u0000MN\u0005"+
+ "a\u0000\u0000NO\u0005s\u0000\u0000OP\u0005s\u0000\u0000P\u0002\u0001\u0000"+
+ "\u0000\u0000QR\u0005{\u0000\u0000R\u0004\u0001\u0000\u0000\u0000ST\u0005"+
+ "}\u0000\u0000T\u0006\u0001\u0000\u0000\u0000UV\u0005;\u0000\u0000V\b\u0001"+
+ "\u0000\u0000\u0000WX\u0005p\u0000\u0000XY\u0005u\u0000\u0000YZ\u0005b"+
+ "\u0000\u0000Z[\u0005l\u0000\u0000[\\\u0005i\u0000\u0000\\]\u0005c\u0000"+
+ "\u0000]\n\u0001\u0000\u0000\u0000^_\u0005s\u0000\u0000_`\u0005t\u0000"+
+ "\u0000`a\u0005a\u0000\u0000ab\u0005t\u0000\u0000bc\u0005i\u0000\u0000"+
+ "cd\u0005c\u0000\u0000d\f\u0001\u0000\u0000\u0000ef\u0005(\u0000\u0000"+
+ "f\u000e\u0001\u0000\u0000\u0000gh\u0005)\u0000\u0000h\u0010\u0001\u0000"+
+ "\u0000\u0000ij\u0005,\u0000\u0000j\u0012\u0001\u0000\u0000\u0000kl\u0005"+
+ "i\u0000\u0000lm\u0005n\u0000\u0000mn\u0005t\u0000\u0000n\u0014\u0001\u0000"+
+ "\u0000\u0000op\u0005b\u0000\u0000pq\u0005o\u0000\u0000qr\u0005o\u0000"+
+ "\u0000rs\u0005l\u0000\u0000st\u0005e\u0000\u0000tu\u0005a\u0000\u0000"+
+ "uv\u0005n\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005c\u0000\u0000"+
+ "xy\u0005h\u0000\u0000yz\u0005a\u0000\u0000z{\u0005r\u0000\u0000{\u0018"+
+ "\u0001\u0000\u0000\u0000|}\u0005=\u0000\u0000}\u001a\u0001\u0000\u0000"+
+ "\u0000~\u007f\u0005i\u0000\u0000\u007f\u0080\u0005f\u0000\u0000\u0080"+
+ "\u001c\u0001\u0000\u0000\u0000\u0081\u0082\u0005e\u0000\u0000\u0082\u0083"+
+ "\u0005l\u0000\u0000\u0083\u0084\u0005s\u0000\u0000\u0084\u0085\u0005e"+
+ "\u0000\u0000\u0085\u001e\u0001\u0000\u0000\u0000\u0086\u0087\u0005w\u0000"+
+ "\u0000\u0087\u0088\u0005h\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089"+
+ "\u008a\u0005l\u0000\u0000\u008a\u008b\u0005e\u0000\u0000\u008b \u0001"+
+ "\u0000\u0000\u0000\u008c\u008d\u0005r\u0000\u0000\u008d\u008e\u0005e\u0000"+
+ "\u0000\u008e\u008f\u0005t\u0000\u0000\u008f\u0090\u0005u\u0000\u0000\u0090"+
+ "\u0091\u0005r\u0000\u0000\u0091\u0092\u0005n\u0000\u0000\u0092\"\u0001"+
+ "\u0000\u0000\u0000\u0093\u0094\u0005&\u0000\u0000\u0094\u0095\u0005&\u0000"+
+ "\u0000\u0095$\u0001\u0000\u0000\u0000\u0096\u0097\u0005|\u0000\u0000\u0097"+
+ "\u0098\u0005|\u0000\u0000\u0098&\u0001\u0000\u0000\u0000\u0099\u009a\u0005"+
+ "=\u0000\u0000\u009a\u009b\u0005=\u0000\u0000\u009b(\u0001\u0000\u0000"+
+ "\u0000\u009c\u009d\u0005!\u0000\u0000\u009d\u009e\u0005=\u0000\u0000\u009e"+
+ "*\u0001\u0000\u0000\u0000\u009f\u00a0\u0005<\u0000\u0000\u00a0,\u0001"+
+ "\u0000\u0000\u0000\u00a1\u00a2\u0005<\u0000\u0000\u00a2\u00a3\u0005=\u0000"+
+ "\u0000\u00a3.\u0001\u0000\u0000\u0000\u00a4\u00a5\u0005>\u0000\u0000\u00a5"+
+ "0\u0001\u0000\u0000\u0000\u00a6\u00a7\u0005>\u0000\u0000\u00a7\u00a8\u0005"+
+ "=\u0000\u0000\u00a82\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005+\u0000"+
+ "\u0000\u00aa4\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005-\u0000\u0000\u00ac"+
+ "6\u0001\u0000\u0000\u0000\u00ad\u00ae\u0005*\u0000\u0000\u00ae8\u0001"+
+ "\u0000\u0000\u0000\u00af\u00b0\u0005/\u0000\u0000\u00b0:\u0001\u0000\u0000"+
+ "\u0000\u00b1\u00b2\u0005%\u0000\u0000\u00b2<\u0001\u0000\u0000\u0000\u00b3"+
+ "\u00b4\u0005!\u0000\u0000\u00b4>\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005"+
+ "t\u0000\u0000\u00b6\u00b7\u0005r\u0000\u0000\u00b7\u00b8\u0005u\u0000"+
+ "\u0000\u00b8\u00b9\u0005e\u0000\u0000\u00b9@\u0001\u0000\u0000\u0000\u00ba"+
+ "\u00bb\u0005f\u0000\u0000\u00bb\u00bc\u0005a\u0000\u0000\u00bc\u00bd\u0005"+
+ "l\u0000\u0000\u00bd\u00be\u0005s\u0000\u0000\u00be\u00bf\u0005e\u0000"+
+ "\u0000\u00bfB\u0001\u0000\u0000\u0000\u00c0\u00c1\u0005\'\u0000\u0000"+
+ "\u00c1D\u0001\u0000\u0000\u0000\u00c2\u00c4\u0007\u0000\u0000\u0000\u00c3"+
+ "\u00c2\u0001\u0000\u0000\u0000\u00c4\u00c5\u0001\u0000\u0000\u0000\u00c5"+
+ "\u00c3\u0001\u0000\u0000\u0000\u00c5\u00c6\u0001\u0000\u0000\u0000\u00c6"+
+ "F\u0001\u0000\u0000\u0000\u00c7\u00cb\u0007\u0001\u0000\u0000\u00c8\u00ca"+
+ "\u0007\u0002\u0000\u0000\u00c9\u00c8\u0001\u0000\u0000\u0000\u00ca\u00cd"+
+ "\u0001\u0000\u0000\u0000\u00cb\u00c9\u0001\u0000\u0000\u0000\u00cb\u00cc"+
+ "\u0001\u0000\u0000\u0000\u00ccH\u0001\u0000\u0000\u0000\u00cd\u00cb\u0001"+
+ "\u0000\u0000\u0000\u00ce\u00d0\u0007\u0003\u0000\u0000\u00cf\u00ce\u0001"+
+ "\u0000\u0000\u0000\u00d0\u00d1\u0001\u0000\u0000\u0000\u00d1\u00cf\u0001"+
+ "\u0000\u0000\u0000\u00d1\u00d2\u0001\u0000\u0000\u0000\u00d2\u00d3\u0001"+
+ "\u0000\u0000\u0000\u00d3\u00d4\u0006$\u0000\u0000\u00d4J\u0001\u0000\u0000"+
+ "\u0000\u0004\u0000\u00c5\u00cb\u00d1\u0001\u0006\u0000\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/src/main/java/parser/generated/SimpleJavaLexer.tokens b/src/main/java/parser/generated/SimpleJavaLexer.tokens
index d009d79..d96b83f 100644
--- a/src/main/java/parser/generated/SimpleJavaLexer.tokens
+++ b/src/main/java/parser/generated/SimpleJavaLexer.tokens
@@ -1,8 +1,71 @@
T__0=1
T__1=2
T__2=3
-IDENTIFIER=4
-WS=5
+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
+T__22=23
+T__23=24
+T__24=25
+T__25=26
+T__26=27
+T__27=28
+T__28=29
+T__29=30
+T__30=31
+T__31=32
+T__32=33
+T__33=34
+INTEGERLITERAL=35
+IDENTIFIER=36
+WS=37
'class'=1
'{'=2
'}'=3
+';'=4
+'public'=5
+'static'=6
+'('=7
+')'=8
+','=9
+'int'=10
+'boolean'=11
+'char'=12
+'='=13
+'if'=14
+'else'=15
+'while'=16
+'return'=17
+'&&'=18
+'||'=19
+'=='=20
+'!='=21
+'<'=22
+'<='=23
+'>'=24
+'>='=25
+'+'=26
+'-'=27
+'*'=28
+'/'=29
+'%'=30
+'!'=31
+'true'=32
+'false'=33
+'\''=34
diff --git a/src/main/java/parser/generated/SimpleJavaListener.java b/src/main/java/parser/generated/SimpleJavaListener.java
index bfacf32..00a350a 100644
--- a/src/main/java/parser/generated/SimpleJavaListener.java
+++ b/src/main/java/parser/generated/SimpleJavaListener.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeListener;
@@ -27,4 +27,174 @@ public interface SimpleJavaListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#memberDeclaration}.
+ * @param ctx the parse tree
+ */
+ void enterMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#memberDeclaration}.
+ * @param ctx the parse tree
+ */
+ void exitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#fieldDeclaration}.
+ * @param ctx the parse tree
+ */
+ void enterFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#fieldDeclaration}.
+ * @param ctx the parse tree
+ */
+ void exitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#methodDeclaration}.
+ * @param ctx the parse tree
+ */
+ void enterMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#methodDeclaration}.
+ * @param ctx the parse tree
+ */
+ void exitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#parameterList}.
+ * @param ctx the parse tree
+ */
+ void enterParameterList(SimpleJavaParser.ParameterListContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#parameterList}.
+ * @param ctx the parse tree
+ */
+ void exitParameterList(SimpleJavaParser.ParameterListContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#parameter}.
+ * @param ctx the parse tree
+ */
+ void enterParameter(SimpleJavaParser.ParameterContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#parameter}.
+ * @param ctx the parse tree
+ */
+ void exitParameter(SimpleJavaParser.ParameterContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#type}.
+ * @param ctx the parse tree
+ */
+ void enterType(SimpleJavaParser.TypeContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#type}.
+ * @param ctx the parse tree
+ */
+ void exitType(SimpleJavaParser.TypeContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#statement}.
+ * @param ctx the parse tree
+ */
+ void enterStatement(SimpleJavaParser.StatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#statement}.
+ * @param ctx the parse tree
+ */
+ void exitStatement(SimpleJavaParser.StatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
+ * @param ctx the parse tree
+ */
+ void enterVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
+ * @param ctx the parse tree
+ */
+ void exitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
+ * @param ctx the parse tree
+ */
+ void enterAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
+ * @param ctx the parse tree
+ */
+ void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#ifStatement}.
+ * @param ctx the parse tree
+ */
+ void enterIfStatement(SimpleJavaParser.IfStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
+ * @param ctx the parse tree
+ */
+ void exitIfStatement(SimpleJavaParser.IfStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#whileStatement}.
+ * @param ctx the parse tree
+ */
+ void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
+ * @param ctx the parse tree
+ */
+ void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#returnStatement}.
+ * @param ctx the parse tree
+ */
+ void enterReturnStatement(SimpleJavaParser.ReturnStatementContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#returnStatement}.
+ * @param ctx the parse tree
+ */
+ void exitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#block}.
+ * @param ctx the parse tree
+ */
+ void enterBlock(SimpleJavaParser.BlockContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#block}.
+ * @param ctx the parse tree
+ */
+ void exitBlock(SimpleJavaParser.BlockContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#expression}.
+ * @param ctx the parse tree
+ */
+ void enterExpression(SimpleJavaParser.ExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#expression}.
+ * @param ctx the parse tree
+ */
+ void exitExpression(SimpleJavaParser.ExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#literal}.
+ * @param ctx the parse tree
+ */
+ void enterLiteral(SimpleJavaParser.LiteralContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#literal}.
+ * @param ctx the parse tree
+ */
+ void exitLiteral(SimpleJavaParser.LiteralContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
+ * @param ctx the parse tree
+ */
+ void enterBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
+ * @param ctx the parse tree
+ */
+ void exitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
+ /**
+ * Enter a parse tree produced by {@link SimpleJavaParser#charLiteral}.
+ * @param ctx the parse tree
+ */
+ void enterCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
+ /**
+ * Exit a parse tree produced by {@link SimpleJavaParser#charLiteral}.
+ * @param ctx the parse tree
+ */
+ void exitCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
}
\ No newline at end of file
diff --git a/src/main/java/parser/generated/SimpleJavaParser.java b/src/main/java/parser/generated/SimpleJavaParser.java
index 174e385..79f3da8 100644
--- a/src/main/java/parser/generated/SimpleJavaParser.java
+++ b/src/main/java/parser/generated/SimpleJavaParser.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
@@ -6,8 +6,6 @@ import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
public class SimpleJavaParser extends Parser {
@@ -17,25 +15,45 @@ public class SimpleJavaParser extends Parser {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__0=1, T__1=2, T__2=3, IDENTIFIER=4, WS=5;
+ 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, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, INTEGERLITERAL=35, IDENTIFIER=36, WS=37;
public static final int
- RULE_program = 0, RULE_classDeclaration = 1;
+ RULE_program = 0, RULE_classDeclaration = 1, RULE_memberDeclaration = 2,
+ RULE_fieldDeclaration = 3, RULE_methodDeclaration = 4, RULE_parameterList = 5,
+ RULE_parameter = 6, RULE_type = 7, RULE_statement = 8, RULE_variableDeclarationStatement = 9,
+ RULE_assignmentStatement = 10, RULE_ifStatement = 11, RULE_whileStatement = 12,
+ RULE_returnStatement = 13, RULE_block = 14, RULE_expression = 15, RULE_literal = 16,
+ RULE_booleanLiteral = 17, RULE_charLiteral = 18;
private static String[] makeRuleNames() {
return new String[] {
- "program", "classDeclaration"
+ "program", "classDeclaration", "memberDeclaration", "fieldDeclaration",
+ "methodDeclaration", "parameterList", "parameter", "type", "statement",
+ "variableDeclarationStatement", "assignmentStatement", "ifStatement",
+ "whileStatement", "returnStatement", "block", "expression", "literal",
+ "booleanLiteral", "charLiteral"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
- null, "'class'", "'{'", "'}'"
+ null, "'class'", "'{'", "'}'", "';'", "'public'", "'static'", "'('",
+ "')'", "','", "'int'", "'boolean'", "'char'", "'='", "'if'", "'else'",
+ "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", "'<='",
+ "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", "'false'",
+ "'''"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
- null, null, null, null, "IDENTIFIER", "WS"
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, "INTEGERLITERAL",
+ "IDENTIFIER", "WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -123,17 +141,17 @@ public class SimpleJavaParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(5);
+ setState(39);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
- setState(4);
+ setState(38);
classDeclaration();
}
}
- setState(7);
+ setState(41);
_errHandler.sync(this);
_la = _input.LA(1);
} while ( _la==T__0 );
@@ -153,6 +171,12 @@ public class SimpleJavaParser extends Parser {
@SuppressWarnings("CheckReturnValue")
public static class ClassDeclarationContext extends ParserRuleContext {
public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public List memberDeclaration() {
+ return getRuleContexts(MemberDeclarationContext.class);
+ }
+ public MemberDeclarationContext memberDeclaration(int i) {
+ return getRuleContext(MemberDeclarationContext.class,i);
+ }
public ClassDeclarationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@@ -175,16 +199,31 @@ public class SimpleJavaParser extends Parser {
public final ClassDeclarationContext classDeclaration() throws RecognitionException {
ClassDeclarationContext _localctx = new ClassDeclarationContext(_ctx, getState());
enterRule(_localctx, 2, RULE_classDeclaration);
+ int _la;
try {
enterOuterAlt(_localctx, 1);
{
- setState(9);
+ setState(43);
match(T__0);
- setState(10);
+ setState(44);
match(IDENTIFIER);
- setState(11);
+ setState(45);
match(T__1);
- setState(12);
+ setState(49);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7200L) != 0)) {
+ {
+ {
+ setState(46);
+ memberDeclaration();
+ }
+ }
+ setState(51);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(52);
match(T__2);
}
}
@@ -199,17 +238,1336 @@ public class SimpleJavaParser extends Parser {
return _localctx;
}
+ @SuppressWarnings("CheckReturnValue")
+ public static class MemberDeclarationContext extends ParserRuleContext {
+ public FieldDeclarationContext fieldDeclaration() {
+ return getRuleContext(FieldDeclarationContext.class,0);
+ }
+ public MethodDeclarationContext methodDeclaration() {
+ return getRuleContext(MethodDeclarationContext.class,0);
+ }
+ public MemberDeclarationContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_memberDeclaration; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterMemberDeclaration(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitMemberDeclaration(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitMemberDeclaration(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final MemberDeclarationContext memberDeclaration() throws RecognitionException {
+ MemberDeclarationContext _localctx = new MemberDeclarationContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_memberDeclaration);
+ try {
+ setState(56);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__9:
+ case T__10:
+ case T__11:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(54);
+ fieldDeclaration();
+ }
+ break;
+ case T__4:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(55);
+ methodDeclaration();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class FieldDeclarationContext extends ParserRuleContext {
+ public TypeContext type() {
+ return getRuleContext(TypeContext.class,0);
+ }
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public FieldDeclarationContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_fieldDeclaration; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterFieldDeclaration(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitFieldDeclaration(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitFieldDeclaration(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final FieldDeclarationContext fieldDeclaration() throws RecognitionException {
+ FieldDeclarationContext _localctx = new FieldDeclarationContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_fieldDeclaration);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(58);
+ type();
+ setState(59);
+ match(IDENTIFIER);
+ setState(60);
+ match(T__3);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class MethodDeclarationContext extends ParserRuleContext {
+ public TypeContext type() {
+ return getRuleContext(TypeContext.class,0);
+ }
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public ParameterListContext parameterList() {
+ return getRuleContext(ParameterListContext.class,0);
+ }
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public MethodDeclarationContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_methodDeclaration; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterMethodDeclaration(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitMethodDeclaration(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitMethodDeclaration(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final MethodDeclarationContext methodDeclaration() throws RecognitionException {
+ MethodDeclarationContext _localctx = new MethodDeclarationContext(_ctx, getState());
+ enterRule(_localctx, 8, RULE_methodDeclaration);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(62);
+ match(T__4);
+ setState(63);
+ match(T__5);
+ setState(64);
+ type();
+ setState(65);
+ match(IDENTIFIER);
+ setState(66);
+ match(T__6);
+ setState(68);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7168L) != 0)) {
+ {
+ setState(67);
+ parameterList();
+ }
+ }
+
+ setState(70);
+ match(T__7);
+ setState(71);
+ match(T__1);
+ setState(75);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 68719696900L) != 0)) {
+ {
+ {
+ setState(72);
+ statement();
+ }
+ }
+ setState(77);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(78);
+ match(T__2);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ParameterListContext extends ParserRuleContext {
+ public List parameter() {
+ return getRuleContexts(ParameterContext.class);
+ }
+ public ParameterContext parameter(int i) {
+ return getRuleContext(ParameterContext.class,i);
+ }
+ public ParameterListContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_parameterList; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterParameterList(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitParameterList(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitParameterList(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ParameterListContext parameterList() throws RecognitionException {
+ ParameterListContext _localctx = new ParameterListContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_parameterList);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(80);
+ parameter();
+ setState(85);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__8) {
+ {
+ {
+ setState(81);
+ match(T__8);
+ setState(82);
+ parameter();
+ }
+ }
+ setState(87);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ParameterContext extends ParserRuleContext {
+ public TypeContext type() {
+ return getRuleContext(TypeContext.class,0);
+ }
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public ParameterContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_parameter; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterParameter(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitParameter(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitParameter(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ParameterContext parameter() throws RecognitionException {
+ ParameterContext _localctx = new ParameterContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_parameter);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(88);
+ type();
+ setState(89);
+ match(IDENTIFIER);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class TypeContext extends ParserRuleContext {
+ public TypeContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_type; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterType(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitType(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitType(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final TypeContext type() throws RecognitionException {
+ TypeContext _localctx = new TypeContext(_ctx, getState());
+ enterRule(_localctx, 14, RULE_type);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(91);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 7168L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class StatementContext extends ParserRuleContext {
+ public VariableDeclarationStatementContext variableDeclarationStatement() {
+ return getRuleContext(VariableDeclarationStatementContext.class,0);
+ }
+ public AssignmentStatementContext assignmentStatement() {
+ return getRuleContext(AssignmentStatementContext.class,0);
+ }
+ public IfStatementContext ifStatement() {
+ return getRuleContext(IfStatementContext.class,0);
+ }
+ public WhileStatementContext whileStatement() {
+ return getRuleContext(WhileStatementContext.class,0);
+ }
+ public ReturnStatementContext returnStatement() {
+ return getRuleContext(ReturnStatementContext.class,0);
+ }
+ public BlockContext block() {
+ return getRuleContext(BlockContext.class,0);
+ }
+ public StatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_statement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final StatementContext statement() throws RecognitionException {
+ StatementContext _localctx = new StatementContext(_ctx, getState());
+ enterRule(_localctx, 16, RULE_statement);
+ try {
+ setState(99);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__9:
+ case T__10:
+ case T__11:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(93);
+ variableDeclarationStatement();
+ }
+ break;
+ case IDENTIFIER:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(94);
+ assignmentStatement();
+ }
+ break;
+ case T__13:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(95);
+ ifStatement();
+ }
+ break;
+ case T__15:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(96);
+ whileStatement();
+ }
+ break;
+ case T__16:
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(97);
+ returnStatement();
+ }
+ break;
+ case T__1:
+ enterOuterAlt(_localctx, 6);
+ {
+ setState(98);
+ block();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class VariableDeclarationStatementContext extends ParserRuleContext {
+ public TypeContext type() {
+ return getRuleContext(TypeContext.class,0);
+ }
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public VariableDeclarationStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_variableDeclarationStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterVariableDeclarationStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitVariableDeclarationStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitVariableDeclarationStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final VariableDeclarationStatementContext variableDeclarationStatement() throws RecognitionException {
+ VariableDeclarationStatementContext _localctx = new VariableDeclarationStatementContext(_ctx, getState());
+ enterRule(_localctx, 18, RULE_variableDeclarationStatement);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(101);
+ type();
+ setState(102);
+ match(IDENTIFIER);
+ setState(105);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ if (_la==T__12) {
+ {
+ setState(103);
+ match(T__12);
+ setState(104);
+ expression(0);
+ }
+ }
+
+ setState(107);
+ match(T__3);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class AssignmentStatementContext extends ParserRuleContext {
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public AssignmentStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_assignmentStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterAssignmentStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitAssignmentStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitAssignmentStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final AssignmentStatementContext assignmentStatement() throws RecognitionException {
+ AssignmentStatementContext _localctx = new AssignmentStatementContext(_ctx, getState());
+ enterRule(_localctx, 20, RULE_assignmentStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(109);
+ match(IDENTIFIER);
+ setState(110);
+ match(T__12);
+ setState(111);
+ expression(0);
+ setState(112);
+ match(T__3);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class IfStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public IfStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_ifStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterIfStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitIfStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitIfStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final IfStatementContext ifStatement() throws RecognitionException {
+ IfStatementContext _localctx = new IfStatementContext(_ctx, getState());
+ enterRule(_localctx, 22, RULE_ifStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(114);
+ match(T__13);
+ setState(115);
+ match(T__6);
+ setState(116);
+ expression(0);
+ setState(117);
+ match(T__7);
+ setState(118);
+ statement();
+ setState(121);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
+ case 1:
+ {
+ setState(119);
+ match(T__14);
+ setState(120);
+ statement();
+ }
+ break;
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class WhileStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public StatementContext statement() {
+ return getRuleContext(StatementContext.class,0);
+ }
+ public WhileStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_whileStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterWhileStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitWhileStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitWhileStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final WhileStatementContext whileStatement() throws RecognitionException {
+ WhileStatementContext _localctx = new WhileStatementContext(_ctx, getState());
+ enterRule(_localctx, 24, RULE_whileStatement);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(123);
+ match(T__15);
+ setState(124);
+ match(T__6);
+ setState(125);
+ expression(0);
+ setState(126);
+ match(T__7);
+ setState(127);
+ statement();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ReturnStatementContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public ReturnStatementContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_returnStatement; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterReturnStatement(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitReturnStatement(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitReturnStatement(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ReturnStatementContext returnStatement() throws RecognitionException {
+ ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, getState());
+ enterRule(_localctx, 26, RULE_returnStatement);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(129);
+ match(T__16);
+ setState(131);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 135425687680L) != 0)) {
+ {
+ setState(130);
+ expression(0);
+ }
+ }
+
+ setState(133);
+ match(T__3);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class BlockContext extends ParserRuleContext {
+ public List statement() {
+ return getRuleContexts(StatementContext.class);
+ }
+ public StatementContext statement(int i) {
+ return getRuleContext(StatementContext.class,i);
+ }
+ public BlockContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_block; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterBlock(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitBlock(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitBlock(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final BlockContext block() throws RecognitionException {
+ BlockContext _localctx = new BlockContext(_ctx, getState());
+ enterRule(_localctx, 28, RULE_block);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(135);
+ match(T__1);
+ setState(139);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 68719696900L) != 0)) {
+ {
+ {
+ setState(136);
+ statement();
+ }
+ }
+ setState(141);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(142);
+ match(T__2);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class ExpressionContext extends ParserRuleContext {
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public LiteralContext literal() {
+ return getRuleContext(LiteralContext.class,0);
+ }
+ public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); }
+ public ExpressionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_expression; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterExpression(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitExpression(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitExpression(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final ExpressionContext expression() throws RecognitionException {
+ return expression(0);
+ }
+
+ private ExpressionContext expression(int _p) throws RecognitionException {
+ ParserRuleContext _parentctx = _ctx;
+ int _parentState = getState();
+ ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState);
+ ExpressionContext _prevctx = _localctx;
+ int _startState = 30;
+ enterRecursionRule(_localctx, 30, RULE_expression, _p);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(155);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case T__26:
+ {
+ setState(145);
+ match(T__26);
+ setState(146);
+ expression(5);
+ }
+ break;
+ case T__30:
+ {
+ setState(147);
+ match(T__30);
+ setState(148);
+ expression(4);
+ }
+ break;
+ case T__6:
+ {
+ setState(149);
+ match(T__6);
+ setState(150);
+ expression(0);
+ setState(151);
+ match(T__7);
+ }
+ break;
+ case T__31:
+ case T__32:
+ case T__33:
+ case INTEGERLITERAL:
+ {
+ setState(153);
+ literal();
+ }
+ break;
+ case IDENTIFIER:
+ {
+ setState(154);
+ match(IDENTIFIER);
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ _ctx.stop = _input.LT(-1);
+ setState(168);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,13,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ if ( _parseListeners!=null ) triggerExitRuleEvent();
+ _prevctx = _localctx;
+ {
+ setState(166);
+ _errHandler.sync(this);
+ switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) {
+ case 1:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(157);
+ if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
+ setState(158);
+ _la = _input.LA(1);
+ if ( !(_la==T__17 || _la==T__18) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(159);
+ expression(9);
+ }
+ break;
+ case 2:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(160);
+ if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
+ setState(161);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 66060288L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(162);
+ expression(8);
+ }
+ break;
+ case 3:
+ {
+ _localctx = new ExpressionContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_expression);
+ setState(163);
+ if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
+ setState(164);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 2080374784L) != 0)) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ setState(165);
+ expression(7);
+ }
+ break;
+ }
+ }
+ }
+ setState(170);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,13,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ unrollRecursionContexts(_parentctx);
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class LiteralContext extends ParserRuleContext {
+ public TerminalNode INTEGERLITERAL() { return getToken(SimpleJavaParser.INTEGERLITERAL, 0); }
+ public BooleanLiteralContext booleanLiteral() {
+ return getRuleContext(BooleanLiteralContext.class,0);
+ }
+ public CharLiteralContext charLiteral() {
+ return getRuleContext(CharLiteralContext.class,0);
+ }
+ public LiteralContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_literal; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitLiteral(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitLiteral(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final LiteralContext literal() throws RecognitionException {
+ LiteralContext _localctx = new LiteralContext(_ctx, getState());
+ enterRule(_localctx, 32, RULE_literal);
+ try {
+ setState(174);
+ _errHandler.sync(this);
+ switch (_input.LA(1)) {
+ case INTEGERLITERAL:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(171);
+ match(INTEGERLITERAL);
+ }
+ break;
+ case T__31:
+ case T__32:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(172);
+ booleanLiteral();
+ }
+ break;
+ case T__33:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(173);
+ charLiteral();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class BooleanLiteralContext extends ParserRuleContext {
+ public BooleanLiteralContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_booleanLiteral; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterBooleanLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitBooleanLiteral(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitBooleanLiteral(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final BooleanLiteralContext booleanLiteral() throws RecognitionException {
+ BooleanLiteralContext _localctx = new BooleanLiteralContext(_ctx, getState());
+ enterRule(_localctx, 34, RULE_booleanLiteral);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(176);
+ _la = _input.LA(1);
+ if ( !(_la==T__31 || _la==T__32) ) {
+ _errHandler.recoverInline(this);
+ }
+ else {
+ if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
+ _errHandler.reportMatch(this);
+ consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ @SuppressWarnings("CheckReturnValue")
+ public static class CharLiteralContext extends ParserRuleContext {
+ public CharLiteralContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_charLiteral; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterCharLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitCharLiteral(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor extends T>)visitor).visitCharLiteral(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final CharLiteralContext charLiteral() throws RecognitionException {
+ CharLiteralContext _localctx = new CharLiteralContext(_ctx, getState());
+ enterRule(_localctx, 36, RULE_charLiteral);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(178);
+ match(T__33);
+ setState(179);
+ matchWildcard();
+ setState(180);
+ match(T__33);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
+ switch (ruleIndex) {
+ case 15:
+ return expression_sempred((ExpressionContext)_localctx, predIndex);
+ }
+ return true;
+ }
+ private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
+ switch (predIndex) {
+ case 0:
+ return precpred(_ctx, 8);
+ case 1:
+ return precpred(_ctx, 7);
+ case 2:
+ return precpred(_ctx, 6);
+ }
+ return true;
+ }
+
public static final String _serializedATN =
- "\u0004\u0001\u0005\u000f\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001"+
- "\u0001\u0000\u0004\u0000\u0006\b\u0000\u000b\u0000\f\u0000\u0007\u0001"+
- "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0000"+
- "\u0000\u0002\u0000\u0002\u0000\u0000\r\u0000\u0005\u0001\u0000\u0000\u0000"+
- "\u0002\t\u0001\u0000\u0000\u0000\u0004\u0006\u0003\u0002\u0001\u0000\u0005"+
- "\u0004\u0001\u0000\u0000\u0000\u0006\u0007\u0001\u0000\u0000\u0000\u0007"+
- "\u0005\u0001\u0000\u0000\u0000\u0007\b\u0001\u0000\u0000\u0000\b\u0001"+
- "\u0001\u0000\u0000\u0000\t\n\u0005\u0001\u0000\u0000\n\u000b\u0005\u0004"+
- "\u0000\u0000\u000b\f\u0005\u0002\u0000\u0000\f\r\u0005\u0003\u0000\u0000"+
- "\r\u0003\u0001\u0000\u0000\u0000\u0001\u0007";
+ "\u0004\u0001%\u00b7\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
+ "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+
+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+
+ "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+
+ "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f"+
+ "\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012"+
+ "\u0001\u0000\u0004\u0000(\b\u0000\u000b\u0000\f\u0000)\u0001\u0001\u0001"+
+ "\u0001\u0001\u0001\u0001\u0001\u0005\u00010\b\u0001\n\u0001\f\u00013\t"+
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0003\u00029\b"+
+ "\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001"+
+ "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0003\u0004E\b"+
+ "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0005\u0004J\b\u0004\n\u0004"+
+ "\f\u0004M\t\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001"+
+ "\u0005\u0005\u0005T\b\u0005\n\u0005\f\u0005W\t\u0005\u0001\u0006\u0001"+
+ "\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001"+
+ "\b\u0001\b\u0001\b\u0003\bd\b\b\u0001\t\u0001\t\u0001\t\u0001\t\u0003"+
+ "\tj\b\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+
+ "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+
+ "\u000b\u0003\u000bz\b\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001"+
+ "\f\u0001\r\u0001\r\u0003\r\u0084\b\r\u0001\r\u0001\r\u0001\u000e\u0001"+
+ "\u000e\u0005\u000e\u008a\b\u000e\n\u000e\f\u000e\u008d\t\u000e\u0001\u000e"+
+ "\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+
+ "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+
+ "\u0003\u000f\u009c\b\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+
+ "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0005\u000f"+
+ "\u00a7\b\u000f\n\u000f\f\u000f\u00aa\t\u000f\u0001\u0010\u0001\u0010\u0001"+
+ "\u0010\u0003\u0010\u00af\b\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+
+ "\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0000\u0001\u001e\u0013\u0000"+
+ "\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c"+
+ "\u001e \"$\u0000\u0005\u0001\u0000\n\f\u0001\u0000\u0012\u0013\u0001\u0000"+
+ "\u0014\u0019\u0001\u0000\u001a\u001e\u0001\u0000 !\u00bb\u0000\'\u0001"+
+ "\u0000\u0000\u0000\u0002+\u0001\u0000\u0000\u0000\u00048\u0001\u0000\u0000"+
+ "\u0000\u0006:\u0001\u0000\u0000\u0000\b>\u0001\u0000\u0000\u0000\nP\u0001"+
+ "\u0000\u0000\u0000\fX\u0001\u0000\u0000\u0000\u000e[\u0001\u0000\u0000"+
+ "\u0000\u0010c\u0001\u0000\u0000\u0000\u0012e\u0001\u0000\u0000\u0000\u0014"+
+ "m\u0001\u0000\u0000\u0000\u0016r\u0001\u0000\u0000\u0000\u0018{\u0001"+
+ "\u0000\u0000\u0000\u001a\u0081\u0001\u0000\u0000\u0000\u001c\u0087\u0001"+
+ "\u0000\u0000\u0000\u001e\u009b\u0001\u0000\u0000\u0000 \u00ae\u0001\u0000"+
+ "\u0000\u0000\"\u00b0\u0001\u0000\u0000\u0000$\u00b2\u0001\u0000\u0000"+
+ "\u0000&(\u0003\u0002\u0001\u0000\'&\u0001\u0000\u0000\u0000()\u0001\u0000"+
+ "\u0000\u0000)\'\u0001\u0000\u0000\u0000)*\u0001\u0000\u0000\u0000*\u0001"+
+ "\u0001\u0000\u0000\u0000+,\u0005\u0001\u0000\u0000,-\u0005$\u0000\u0000"+
+ "-1\u0005\u0002\u0000\u0000.0\u0003\u0004\u0002\u0000/.\u0001\u0000\u0000"+
+ "\u000003\u0001\u0000\u0000\u00001/\u0001\u0000\u0000\u000012\u0001\u0000"+
+ "\u0000\u000024\u0001\u0000\u0000\u000031\u0001\u0000\u0000\u000045\u0005"+
+ "\u0003\u0000\u00005\u0003\u0001\u0000\u0000\u000069\u0003\u0006\u0003"+
+ "\u000079\u0003\b\u0004\u000086\u0001\u0000\u0000\u000087\u0001\u0000\u0000"+
+ "\u00009\u0005\u0001\u0000\u0000\u0000:;\u0003\u000e\u0007\u0000;<\u0005"+
+ "$\u0000\u0000<=\u0005\u0004\u0000\u0000=\u0007\u0001\u0000\u0000\u0000"+
+ ">?\u0005\u0005\u0000\u0000?@\u0005\u0006\u0000\u0000@A\u0003\u000e\u0007"+
+ "\u0000AB\u0005$\u0000\u0000BD\u0005\u0007\u0000\u0000CE\u0003\n\u0005"+
+ "\u0000DC\u0001\u0000\u0000\u0000DE\u0001\u0000\u0000\u0000EF\u0001\u0000"+
+ "\u0000\u0000FG\u0005\b\u0000\u0000GK\u0005\u0002\u0000\u0000HJ\u0003\u0010"+
+ "\b\u0000IH\u0001\u0000\u0000\u0000JM\u0001\u0000\u0000\u0000KI\u0001\u0000"+
+ "\u0000\u0000KL\u0001\u0000\u0000\u0000LN\u0001\u0000\u0000\u0000MK\u0001"+
+ "\u0000\u0000\u0000NO\u0005\u0003\u0000\u0000O\t\u0001\u0000\u0000\u0000"+
+ "PU\u0003\f\u0006\u0000QR\u0005\t\u0000\u0000RT\u0003\f\u0006\u0000SQ\u0001"+
+ "\u0000\u0000\u0000TW\u0001\u0000\u0000\u0000US\u0001\u0000\u0000\u0000"+
+ "UV\u0001\u0000\u0000\u0000V\u000b\u0001\u0000\u0000\u0000WU\u0001\u0000"+
+ "\u0000\u0000XY\u0003\u000e\u0007\u0000YZ\u0005$\u0000\u0000Z\r\u0001\u0000"+
+ "\u0000\u0000[\\\u0007\u0000\u0000\u0000\\\u000f\u0001\u0000\u0000\u0000"+
+ "]d\u0003\u0012\t\u0000^d\u0003\u0014\n\u0000_d\u0003\u0016\u000b\u0000"+
+ "`d\u0003\u0018\f\u0000ad\u0003\u001a\r\u0000bd\u0003\u001c\u000e\u0000"+
+ "c]\u0001\u0000\u0000\u0000c^\u0001\u0000\u0000\u0000c_\u0001\u0000\u0000"+
+ "\u0000c`\u0001\u0000\u0000\u0000ca\u0001\u0000\u0000\u0000cb\u0001\u0000"+
+ "\u0000\u0000d\u0011\u0001\u0000\u0000\u0000ef\u0003\u000e\u0007\u0000"+
+ "fi\u0005$\u0000\u0000gh\u0005\r\u0000\u0000hj\u0003\u001e\u000f\u0000"+
+ "ig\u0001\u0000\u0000\u0000ij\u0001\u0000\u0000\u0000jk\u0001\u0000\u0000"+
+ "\u0000kl\u0005\u0004\u0000\u0000l\u0013\u0001\u0000\u0000\u0000mn\u0005"+
+ "$\u0000\u0000no\u0005\r\u0000\u0000op\u0003\u001e\u000f\u0000pq\u0005"+
+ "\u0004\u0000\u0000q\u0015\u0001\u0000\u0000\u0000rs\u0005\u000e\u0000"+
+ "\u0000st\u0005\u0007\u0000\u0000tu\u0003\u001e\u000f\u0000uv\u0005\b\u0000"+
+ "\u0000vy\u0003\u0010\b\u0000wx\u0005\u000f\u0000\u0000xz\u0003\u0010\b"+
+ "\u0000yw\u0001\u0000\u0000\u0000yz\u0001\u0000\u0000\u0000z\u0017\u0001"+
+ "\u0000\u0000\u0000{|\u0005\u0010\u0000\u0000|}\u0005\u0007\u0000\u0000"+
+ "}~\u0003\u001e\u000f\u0000~\u007f\u0005\b\u0000\u0000\u007f\u0080\u0003"+
+ "\u0010\b\u0000\u0080\u0019\u0001\u0000\u0000\u0000\u0081\u0083\u0005\u0011"+
+ "\u0000\u0000\u0082\u0084\u0003\u001e\u000f\u0000\u0083\u0082\u0001\u0000"+
+ "\u0000\u0000\u0083\u0084\u0001\u0000\u0000\u0000\u0084\u0085\u0001\u0000"+
+ "\u0000\u0000\u0085\u0086\u0005\u0004\u0000\u0000\u0086\u001b\u0001\u0000"+
+ "\u0000\u0000\u0087\u008b\u0005\u0002\u0000\u0000\u0088\u008a\u0003\u0010"+
+ "\b\u0000\u0089\u0088\u0001\u0000\u0000\u0000\u008a\u008d\u0001\u0000\u0000"+
+ "\u0000\u008b\u0089\u0001\u0000\u0000\u0000\u008b\u008c\u0001\u0000\u0000"+
+ "\u0000\u008c\u008e\u0001\u0000\u0000\u0000\u008d\u008b\u0001\u0000\u0000"+
+ "\u0000\u008e\u008f\u0005\u0003\u0000\u0000\u008f\u001d\u0001\u0000\u0000"+
+ "\u0000\u0090\u0091\u0006\u000f\uffff\uffff\u0000\u0091\u0092\u0005\u001b"+
+ "\u0000\u0000\u0092\u009c\u0003\u001e\u000f\u0005\u0093\u0094\u0005\u001f"+
+ "\u0000\u0000\u0094\u009c\u0003\u001e\u000f\u0004\u0095\u0096\u0005\u0007"+
+ "\u0000\u0000\u0096\u0097\u0003\u001e\u000f\u0000\u0097\u0098\u0005\b\u0000"+
+ "\u0000\u0098\u009c\u0001\u0000\u0000\u0000\u0099\u009c\u0003 \u0010\u0000"+
+ "\u009a\u009c\u0005$\u0000\u0000\u009b\u0090\u0001\u0000\u0000\u0000\u009b"+
+ "\u0093\u0001\u0000\u0000\u0000\u009b\u0095\u0001\u0000\u0000\u0000\u009b"+
+ "\u0099\u0001\u0000\u0000\u0000\u009b\u009a\u0001\u0000\u0000\u0000\u009c"+
+ "\u00a8\u0001\u0000\u0000\u0000\u009d\u009e\n\b\u0000\u0000\u009e\u009f"+
+ "\u0007\u0001\u0000\u0000\u009f\u00a7\u0003\u001e\u000f\t\u00a0\u00a1\n"+
+ "\u0007\u0000\u0000\u00a1\u00a2\u0007\u0002\u0000\u0000\u00a2\u00a7\u0003"+
+ "\u001e\u000f\b\u00a3\u00a4\n\u0006\u0000\u0000\u00a4\u00a5\u0007\u0003"+
+ "\u0000\u0000\u00a5\u00a7\u0003\u001e\u000f\u0007\u00a6\u009d\u0001\u0000"+
+ "\u0000\u0000\u00a6\u00a0\u0001\u0000\u0000\u0000\u00a6\u00a3\u0001\u0000"+
+ "\u0000\u0000\u00a7\u00aa\u0001\u0000\u0000\u0000\u00a8\u00a6\u0001\u0000"+
+ "\u0000\u0000\u00a8\u00a9\u0001\u0000\u0000\u0000\u00a9\u001f\u0001\u0000"+
+ "\u0000\u0000\u00aa\u00a8\u0001\u0000\u0000\u0000\u00ab\u00af\u0005#\u0000"+
+ "\u0000\u00ac\u00af\u0003\"\u0011\u0000\u00ad\u00af\u0003$\u0012\u0000"+
+ "\u00ae\u00ab\u0001\u0000\u0000\u0000\u00ae\u00ac\u0001\u0000\u0000\u0000"+
+ "\u00ae\u00ad\u0001\u0000\u0000\u0000\u00af!\u0001\u0000\u0000\u0000\u00b0"+
+ "\u00b1\u0007\u0004\u0000\u0000\u00b1#\u0001\u0000\u0000\u0000\u00b2\u00b3"+
+ "\u0005\"\u0000\u0000\u00b3\u00b4\t\u0000\u0000\u0000\u00b4\u00b5\u0005"+
+ "\"\u0000\u0000\u00b5%\u0001\u0000\u0000\u0000\u000f)18DKUciy\u0083\u008b"+
+ "\u009b\u00a6\u00a8\u00ae";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/src/main/java/parser/generated/SimpleJavaVisitor.java b/src/main/java/parser/generated/SimpleJavaVisitor.java
index c00434b..adb2560 100644
--- a/src/main/java/parser/generated/SimpleJavaVisitor.java
+++ b/src/main/java/parser/generated/SimpleJavaVisitor.java
@@ -1,4 +1,4 @@
-// Generated from C:/Users/Johannes Ehlert/Documents/Git/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
+// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
@@ -22,4 +22,106 @@ public interface SimpleJavaVisitor extends ParseTreeVisitor {
* @return the visitor result
*/
T visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#memberDeclaration}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#fieldDeclaration}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#methodDeclaration}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#parameterList}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitParameterList(SimpleJavaParser.ParameterListContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#parameter}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitParameter(SimpleJavaParser.ParameterContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#type}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitType(SimpleJavaParser.TypeContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#statement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitStatement(SimpleJavaParser.StatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitIfStatement(SimpleJavaParser.IfStatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#returnStatement}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#block}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitBlock(SimpleJavaParser.BlockContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#expression}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitExpression(SimpleJavaParser.ExpressionContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#literal}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitLiteral(SimpleJavaParser.LiteralContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
+ /**
+ * Visit a parse tree produced by {@link SimpleJavaParser#charLiteral}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
}
\ No newline at end of file
diff --git a/src/main/test/java/SimpleJavaFeatureTest.java b/src/main/test/java/SimpleJavaFeatureTest.java
index 4854fb7..b71f63b 100644
--- a/src/main/test/java/SimpleJavaFeatureTest.java
+++ b/src/main/test/java/SimpleJavaFeatureTest.java
@@ -9,6 +9,11 @@ public class SimpleJavaFeatureTest {
this.b = b;
this.c = c;
}
+ private class InnerClass {
+ void innerMethod() {
+ System.out.println("Inner class method");
+ }
+ }
// Methode zur Demonstration von Kontrollstrukturen
void controlStructures() {