From de5c2a50026cb6d6c0b49755aa0bdba2a4767d7a Mon Sep 17 00:00:00 2001 From: Maximilian Stahl Date: Fri, 31 May 2024 11:16:25 +0200 Subject: [PATCH] Added Parser Visitors --- .idea/misc.xml | 4 +- src/main/java/ast/LiteralNode.java | 29 - .../java/ast/literal/BooleanLiteralNode.java | 11 + .../java/ast/literal/CharLiteralNode.java | 11 + src/main/java/ast/literal/LiteralNode.java | 30 + .../statement/AssignmentStatementNode.java | 11 +- .../ast/statement/BlockStatementNode.java | 9 + src/main/java/parser/ASTBuilder.java | 85 ++- src/main/java/parser/SimpleJava.g4 | 4 +- .../java/parser/generated/SimpleJava.interp | 3 +- .../generated/SimpleJavaBaseListener.java | 14 +- .../generated/SimpleJavaBaseVisitor.java | 9 +- .../parser/generated/SimpleJavaLexer.java | 2 +- .../parser/generated/SimpleJavaListener.java | 12 +- .../parser/generated/SimpleJavaParser.java | 567 ++++++++---------- .../parser/generated/SimpleJavaVisitor.java | 8 +- 16 files changed, 401 insertions(+), 408 deletions(-) delete mode 100644 src/main/java/ast/LiteralNode.java create mode 100644 src/main/java/ast/literal/BooleanLiteralNode.java create mode 100644 src/main/java/ast/literal/CharLiteralNode.java create mode 100644 src/main/java/ast/literal/LiteralNode.java create mode 100644 src/main/java/ast/statement/BlockStatementNode.java diff --git a/.idea/misc.xml b/.idea/misc.xml index bb14756..4e21abf 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,7 +6,7 @@ - + \ No newline at end of file diff --git a/src/main/java/ast/LiteralNode.java b/src/main/java/ast/LiteralNode.java deleted file mode 100644 index 3873465..0000000 --- a/src/main/java/ast/LiteralNode.java +++ /dev/null @@ -1,29 +0,0 @@ -package ast; - -import ast.expression.ExpressionNode; -import semantic.SemanticVisitor; -import typechecker.TypeCheckResult; - -public class LiteralNode implements ExpressionNode { - - int value; - private String type; - - public LiteralNode(int value) { - this.value = value; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - - @Override - public TypeCheckResult accept(SemanticVisitor visitor) { - return null; - } -} diff --git a/src/main/java/ast/literal/BooleanLiteralNode.java b/src/main/java/ast/literal/BooleanLiteralNode.java new file mode 100644 index 0000000..4657df7 --- /dev/null +++ b/src/main/java/ast/literal/BooleanLiteralNode.java @@ -0,0 +1,11 @@ +package ast.literal; + +public class BooleanLiteralNode { + private String value; + + public BooleanLiteralNode(String value) {this.value = value;} + + public String getValue() { + return value; + } +} diff --git a/src/main/java/ast/literal/CharLiteralNode.java b/src/main/java/ast/literal/CharLiteralNode.java new file mode 100644 index 0000000..c77c073 --- /dev/null +++ b/src/main/java/ast/literal/CharLiteralNode.java @@ -0,0 +1,11 @@ +package ast.literal; + +public class CharLiteralNode { + public String value; + + public CharLiteralNode(String value) {this.value = value;} + + public String getValue() { + return value; + } +} diff --git a/src/main/java/ast/literal/LiteralNode.java b/src/main/java/ast/literal/LiteralNode.java new file mode 100644 index 0000000..66dbc74 --- /dev/null +++ b/src/main/java/ast/literal/LiteralNode.java @@ -0,0 +1,30 @@ +package ast.literal; + +import ast.expression.ExpressionNode; +import semantic.SemanticVisitor; +import typechecker.TypeCheckResult; + +public class LiteralNode implements ExpressionNode { + + public String value; + private String type; + + public LiteralNode(String value, String type) { + this.value = value; + this.type = type; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + @Override + public TypeCheckResult accept(SemanticVisitor visitor) { + return null; + } +} \ No newline at end of file diff --git a/src/main/java/ast/statement/AssignmentStatementNode.java b/src/main/java/ast/statement/AssignmentStatementNode.java index f9fd38e..68140f7 100644 --- a/src/main/java/ast/statement/AssignmentStatementNode.java +++ b/src/main/java/ast/statement/AssignmentStatementNode.java @@ -1,14 +1,19 @@ package ast.statement; import ast.expression.BinaryExpressionNode; +import ast.expression.ExpressionNode; import semantic.SemanticVisitor; import typechecker.TypeCheckResult; import visitor.Visitable; -public class AssignmentStatementNode extends StatementNode implements Visitable { - public BinaryExpressionNode expression; +import java.beans.Expression; - public AssignmentStatementNode(BinaryExpressionNode expression) { +public class AssignmentStatementNode extends StatementNode implements Visitable { + public String identifier; + public ExpressionNode expression; + + public AssignmentStatementNode(String identifier, ExpressionNode expression) { + this.identifier = identifier; this.expression = expression; } diff --git a/src/main/java/ast/statement/BlockStatementNode.java b/src/main/java/ast/statement/BlockStatementNode.java new file mode 100644 index 0000000..71516a8 --- /dev/null +++ b/src/main/java/ast/statement/BlockStatementNode.java @@ -0,0 +1,9 @@ +package ast.statement; + +import java.util.List; + +public class BlockStatementNode { + List statements; + + public BlockStatementNode(List statements) {this.statements = statements;} +} diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java index 0f3b09c..446b7eb 100644 --- a/src/main/java/parser/ASTBuilder.java +++ b/src/main/java/parser/ASTBuilder.java @@ -6,6 +6,9 @@ import ast.expression.ExpressionNode; import ast.expression.ExpresssionOperator; import ast.expression.IdentifierExpressionNode; import ast.expression.UnaryExpressionNode; +import ast.literal.BooleanLiteralNode; +import ast.literal.CharLiteralNode; +import ast.literal.LiteralNode; import ast.member.FieldNode; import ast.member.MemberNode; import ast.member.MethodNode; @@ -42,6 +45,17 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { return classNode; } + public ASTNode visitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { + if(ctx.fieldDeclaration() != null) { + return visitFieldDeclaration(ctx.fieldDeclaration()); + } else if(ctx.methodDeclaration() != null) { + return visitMethodDeclaration(ctx.methodDeclaration()); + } else if(ctx.constructorDeclaration() != null) { + return visitConstructorDeclaration(ctx.constructorDeclaration()); + } + return null; + } + @Override public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) { AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType()); @@ -116,12 +130,19 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitStatement(SimpleJavaParser.StatementContext ctx) { - if (ctx.variableDeclarationStatement() != null) { + if(ctx.variableDeclarationStatement() != null) { return visitVariableDeclarationStatement(ctx.variableDeclarationStatement()); - } else if (ctx.assignmentStatement() != null) { + } else if(ctx.assignmentStatement() != null) { return visitAssignmentStatement(ctx.assignmentStatement()); + } else if(ctx.ifStatement() != null) { + return visitIfStatement(ctx.ifStatement()); + } else if(ctx.whileStatement() != null) { + return visitWhileStatement(ctx.whileStatement()); + } else if(ctx.returnStatement() != null) { + return visitReturnStatement(ctx.returnStatement()); + } else if(ctx.block() != null) { + return visitBlock(ctx.block()); } - return null; } @@ -130,7 +151,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { TypeNode type = (TypeNode) visit(ctx.type()); String identifier = ctx.IDENTIFIER().getText(); ExpressionNode expression = null; - if (ctx.expression() != null) { + if(ctx.expression() != null) { expression = (ExpressionNode) visit(ctx.expression()); } return new VariableDeclarationStatementNode(type, identifier, expression); @@ -138,14 +159,8 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { - - BinaryExpressionNode expression = (BinaryExpressionNode) visit(ctx.expression()); - return new AssignmentStatementNode(expression); - } - - @Override - public ASTNode visitVar(SimpleJavaParser.VarContext ctx) { - return null; + ExpressionNode expression = (ExpressionNode) visit(ctx.expression()); + return new AssignmentStatementNode(ctx.IDENTIFIER().getText(), expression); } @Override @@ -175,6 +190,15 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { return new ReturnStatementNode(expression); } + @Override + public ASTNode visitBlock(SimpleJavaParser.BlockContext ctx) { + List statements = new ArrayList<>(); + for(SimpleJavaParser.StatementContext stmtCtx : ctx.statement()) { + statements.add((StatementNode) visit(stmtCtx)); + } + return (ASTNode) new BlockStatementNode(statements); + } + @Override public ASTNode visitExpression(SimpleJavaParser.ExpressionContext ctx) { // Handle binary operations @@ -206,16 +230,33 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitLiteral(SimpleJavaParser.LiteralContext ctx) { - LiteralContext literalContext = (LiteralContext) ctx; - try { - int intValue = Integer.parseInt(literalContext.getText()); - LiteralNode literalNode = new LiteralNode(intValue); - - literalNode.setType("int"); - return literalNode; - } catch (NumberFormatException ignored) {} - - return null; // Return null or throw an exception if no valid expression found + String type; + String value; + if(ctx.INTEGERLITERAL() != null) { + type = "int"; + value = ctx.INTEGERLITERAL().getText(); + return new LiteralNode(type, value); + } else if(ctx.booleanLiteral() != null) { + type= "boolean"; + BooleanLiteralNode booleanNode = (BooleanLiteralNode) visitBooleanLiteral(ctx.booleanLiteral()); + value = booleanNode.getValue(); + return new LiteralNode(type, value); + } else if(ctx.charLiteral() != null) { + type= "char"; + CharLiteralNode charNode = (CharLiteralNode) visitCharLiteral(ctx.charLiteral()); + value = charNode.getValue(); + return new LiteralNode(type, value); + } + return null; } + @Override + public ASTNode visitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { + return super.visitBooleanLiteral(ctx); + } + + @Override + public ASTNode visitCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { + return super.visitCharLiteral(ctx); + } } diff --git a/src/main/java/parser/SimpleJava.g4 b/src/main/java/parser/SimpleJava.g4 index 7d09aba..3de3979 100644 --- a/src/main/java/parser/SimpleJava.g4 +++ b/src/main/java/parser/SimpleJava.g4 @@ -29,9 +29,7 @@ statement variableDeclarationStatement : type IDENTIFIER ('=' expression)? ';' ; -assignmentStatement : var '=' expression ';' ; - -var: IDENTIFIER; +assignmentStatement : IDENTIFIER '=' expression ';' ; ifStatement : 'if' '(' expression ')' statement ('else' statement)? ; diff --git a/src/main/java/parser/generated/SimpleJava.interp b/src/main/java/parser/generated/SimpleJava.interp index c3cff60..00547cb 100644 --- a/src/main/java/parser/generated/SimpleJava.interp +++ b/src/main/java/parser/generated/SimpleJava.interp @@ -94,7 +94,6 @@ accessType statement variableDeclarationStatement assignmentStatement -var ifStatement whileStatement returnStatement @@ -106,4 +105,4 @@ charLiteral atn: -[4, 1, 38, 212, 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, 1, 0, 4, 0, 46, 8, 0, 11, 0, 12, 0, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 55, 8, 1, 10, 1, 12, 1, 58, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 2, 65, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 78, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 83, 8, 4, 10, 4, 12, 4, 86, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 94, 8, 5, 1, 5, 1, 5, 1, 5, 5, 5, 99, 8, 5, 10, 5, 12, 5, 102, 9, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 5, 6, 109, 8, 6, 10, 6, 12, 6, 112, 9, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 127, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 133, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 151, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 3, 16, 161, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 167, 8, 17, 10, 17, 12, 17, 170, 9, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 185, 8, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 5, 18, 196, 8, 18, 10, 18, 12, 18, 199, 9, 18, 1, 19, 1, 19, 1, 19, 3, 19, 204, 8, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 0, 1, 36, 22, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 0, 6, 1, 0, 9, 11, 1, 0, 12, 13, 1, 0, 19, 20, 1, 0, 21, 26, 1, 0, 27, 31, 1, 0, 33, 34, 216, 0, 45, 1, 0, 0, 0, 2, 49, 1, 0, 0, 0, 4, 64, 1, 0, 0, 0, 6, 66, 1, 0, 0, 0, 8, 71, 1, 0, 0, 0, 10, 89, 1, 0, 0, 0, 12, 105, 1, 0, 0, 0, 14, 113, 1, 0, 0, 0, 16, 116, 1, 0, 0, 0, 18, 118, 1, 0, 0, 0, 20, 126, 1, 0, 0, 0, 22, 128, 1, 0, 0, 0, 24, 136, 1, 0, 0, 0, 26, 141, 1, 0, 0, 0, 28, 143, 1, 0, 0, 0, 30, 152, 1, 0, 0, 0, 32, 158, 1, 0, 0, 0, 34, 164, 1, 0, 0, 0, 36, 184, 1, 0, 0, 0, 38, 203, 1, 0, 0, 0, 40, 205, 1, 0, 0, 0, 42, 207, 1, 0, 0, 0, 44, 46, 3, 2, 1, 0, 45, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 1, 1, 0, 0, 0, 49, 50, 3, 18, 9, 0, 50, 51, 5, 1, 0, 0, 51, 52, 5, 37, 0, 0, 52, 56, 5, 2, 0, 0, 53, 55, 3, 4, 2, 0, 54, 53, 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 59, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 60, 5, 3, 0, 0, 60, 3, 1, 0, 0, 0, 61, 65, 3, 6, 3, 0, 62, 65, 3, 8, 4, 0, 63, 65, 3, 10, 5, 0, 64, 61, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 63, 1, 0, 0, 0, 65, 5, 1, 0, 0, 0, 66, 67, 3, 18, 9, 0, 67, 68, 3, 16, 8, 0, 68, 69, 5, 37, 0, 0, 69, 70, 5, 4, 0, 0, 70, 7, 1, 0, 0, 0, 71, 72, 3, 18, 9, 0, 72, 73, 5, 5, 0, 0, 73, 74, 3, 16, 8, 0, 74, 75, 5, 37, 0, 0, 75, 77, 5, 6, 0, 0, 76, 78, 3, 12, 6, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 80, 5, 7, 0, 0, 80, 84, 5, 2, 0, 0, 81, 83, 3, 20, 10, 0, 82, 81, 1, 0, 0, 0, 83, 86, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 87, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 87, 88, 5, 3, 0, 0, 88, 9, 1, 0, 0, 0, 89, 90, 3, 18, 9, 0, 90, 91, 5, 37, 0, 0, 91, 93, 5, 6, 0, 0, 92, 94, 3, 12, 6, 0, 93, 92, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 5, 7, 0, 0, 96, 100, 5, 2, 0, 0, 97, 99, 3, 20, 10, 0, 98, 97, 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 103, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 3, 0, 0, 104, 11, 1, 0, 0, 0, 105, 110, 3, 14, 7, 0, 106, 107, 5, 8, 0, 0, 107, 109, 3, 14, 7, 0, 108, 106, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 13, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 113, 114, 3, 16, 8, 0, 114, 115, 5, 37, 0, 0, 115, 15, 1, 0, 0, 0, 116, 117, 7, 0, 0, 0, 117, 17, 1, 0, 0, 0, 118, 119, 7, 1, 0, 0, 119, 19, 1, 0, 0, 0, 120, 127, 3, 22, 11, 0, 121, 127, 3, 24, 12, 0, 122, 127, 3, 28, 14, 0, 123, 127, 3, 30, 15, 0, 124, 127, 3, 32, 16, 0, 125, 127, 3, 34, 17, 0, 126, 120, 1, 0, 0, 0, 126, 121, 1, 0, 0, 0, 126, 122, 1, 0, 0, 0, 126, 123, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 125, 1, 0, 0, 0, 127, 21, 1, 0, 0, 0, 128, 129, 3, 16, 8, 0, 129, 132, 5, 37, 0, 0, 130, 131, 5, 14, 0, 0, 131, 133, 3, 36, 18, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 135, 5, 4, 0, 0, 135, 23, 1, 0, 0, 0, 136, 137, 3, 26, 13, 0, 137, 138, 5, 14, 0, 0, 138, 139, 3, 36, 18, 0, 139, 140, 5, 4, 0, 0, 140, 25, 1, 0, 0, 0, 141, 142, 5, 37, 0, 0, 142, 27, 1, 0, 0, 0, 143, 144, 5, 15, 0, 0, 144, 145, 5, 6, 0, 0, 145, 146, 3, 36, 18, 0, 146, 147, 5, 7, 0, 0, 147, 150, 3, 20, 10, 0, 148, 149, 5, 16, 0, 0, 149, 151, 3, 20, 10, 0, 150, 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 29, 1, 0, 0, 0, 152, 153, 5, 17, 0, 0, 153, 154, 5, 6, 0, 0, 154, 155, 3, 36, 18, 0, 155, 156, 5, 7, 0, 0, 156, 157, 3, 20, 10, 0, 157, 31, 1, 0, 0, 0, 158, 160, 5, 18, 0, 0, 159, 161, 3, 36, 18, 0, 160, 159, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 5, 4, 0, 0, 163, 33, 1, 0, 0, 0, 164, 168, 5, 2, 0, 0, 165, 167, 3, 20, 10, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 172, 5, 3, 0, 0, 172, 35, 1, 0, 0, 0, 173, 174, 6, 18, -1, 0, 174, 175, 5, 28, 0, 0, 175, 185, 3, 36, 18, 5, 176, 177, 5, 32, 0, 0, 177, 185, 3, 36, 18, 4, 178, 179, 5, 6, 0, 0, 179, 180, 3, 36, 18, 0, 180, 181, 5, 7, 0, 0, 181, 185, 1, 0, 0, 0, 182, 185, 3, 38, 19, 0, 183, 185, 5, 37, 0, 0, 184, 173, 1, 0, 0, 0, 184, 176, 1, 0, 0, 0, 184, 178, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 184, 183, 1, 0, 0, 0, 185, 197, 1, 0, 0, 0, 186, 187, 10, 8, 0, 0, 187, 188, 7, 2, 0, 0, 188, 196, 3, 36, 18, 9, 189, 190, 10, 7, 0, 0, 190, 191, 7, 3, 0, 0, 191, 196, 3, 36, 18, 8, 192, 193, 10, 6, 0, 0, 193, 194, 7, 4, 0, 0, 194, 196, 3, 36, 18, 7, 195, 186, 1, 0, 0, 0, 195, 189, 1, 0, 0, 0, 195, 192, 1, 0, 0, 0, 196, 199, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 37, 1, 0, 0, 0, 199, 197, 1, 0, 0, 0, 200, 204, 5, 36, 0, 0, 201, 204, 3, 40, 20, 0, 202, 204, 3, 42, 21, 0, 203, 200, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 203, 202, 1, 0, 0, 0, 204, 39, 1, 0, 0, 0, 205, 206, 7, 5, 0, 0, 206, 41, 1, 0, 0, 0, 207, 208, 5, 35, 0, 0, 208, 209, 9, 0, 0, 0, 209, 210, 5, 35, 0, 0, 210, 43, 1, 0, 0, 0, 17, 47, 56, 64, 77, 84, 93, 100, 110, 126, 132, 150, 160, 168, 184, 195, 197, 203] \ No newline at end of file +[4, 1, 38, 208, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 4, 0, 44, 8, 0, 11, 0, 12, 0, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 53, 8, 1, 10, 1, 12, 1, 56, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 2, 63, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 76, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 81, 8, 4, 10, 4, 12, 4, 84, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 92, 8, 5, 1, 5, 1, 5, 1, 5, 5, 5, 97, 8, 5, 10, 5, 12, 5, 100, 9, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 5, 6, 107, 8, 6, 10, 6, 12, 6, 110, 9, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 125, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 131, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 147, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 3, 15, 157, 8, 15, 1, 15, 1, 15, 1, 16, 1, 16, 5, 16, 163, 8, 16, 10, 16, 12, 16, 166, 9, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 181, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 192, 8, 17, 10, 17, 12, 17, 195, 9, 17, 1, 18, 1, 18, 1, 18, 3, 18, 200, 8, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 0, 1, 34, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 0, 6, 1, 0, 9, 11, 1, 0, 12, 13, 1, 0, 19, 20, 1, 0, 21, 26, 1, 0, 27, 31, 1, 0, 33, 34, 213, 0, 43, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 62, 1, 0, 0, 0, 6, 64, 1, 0, 0, 0, 8, 69, 1, 0, 0, 0, 10, 87, 1, 0, 0, 0, 12, 103, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 114, 1, 0, 0, 0, 18, 116, 1, 0, 0, 0, 20, 124, 1, 0, 0, 0, 22, 126, 1, 0, 0, 0, 24, 134, 1, 0, 0, 0, 26, 139, 1, 0, 0, 0, 28, 148, 1, 0, 0, 0, 30, 154, 1, 0, 0, 0, 32, 160, 1, 0, 0, 0, 34, 180, 1, 0, 0, 0, 36, 199, 1, 0, 0, 0, 38, 201, 1, 0, 0, 0, 40, 203, 1, 0, 0, 0, 42, 44, 3, 2, 1, 0, 43, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 1, 1, 0, 0, 0, 47, 48, 3, 18, 9, 0, 48, 49, 5, 1, 0, 0, 49, 50, 5, 37, 0, 0, 50, 54, 5, 2, 0, 0, 51, 53, 3, 4, 2, 0, 52, 51, 1, 0, 0, 0, 53, 56, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 57, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 57, 58, 5, 3, 0, 0, 58, 3, 1, 0, 0, 0, 59, 63, 3, 6, 3, 0, 60, 63, 3, 8, 4, 0, 61, 63, 3, 10, 5, 0, 62, 59, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 5, 1, 0, 0, 0, 64, 65, 3, 18, 9, 0, 65, 66, 3, 16, 8, 0, 66, 67, 5, 37, 0, 0, 67, 68, 5, 4, 0, 0, 68, 7, 1, 0, 0, 0, 69, 70, 3, 18, 9, 0, 70, 71, 5, 5, 0, 0, 71, 72, 3, 16, 8, 0, 72, 73, 5, 37, 0, 0, 73, 75, 5, 6, 0, 0, 74, 76, 3, 12, 6, 0, 75, 74, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 5, 7, 0, 0, 78, 82, 5, 2, 0, 0, 79, 81, 3, 20, 10, 0, 80, 79, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 85, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 86, 5, 3, 0, 0, 86, 9, 1, 0, 0, 0, 87, 88, 3, 18, 9, 0, 88, 89, 5, 37, 0, 0, 89, 91, 5, 6, 0, 0, 90, 92, 3, 12, 6, 0, 91, 90, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 5, 7, 0, 0, 94, 98, 5, 2, 0, 0, 95, 97, 3, 20, 10, 0, 96, 95, 1, 0, 0, 0, 97, 100, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 101, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 101, 102, 5, 3, 0, 0, 102, 11, 1, 0, 0, 0, 103, 108, 3, 14, 7, 0, 104, 105, 5, 8, 0, 0, 105, 107, 3, 14, 7, 0, 106, 104, 1, 0, 0, 0, 107, 110, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 13, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 111, 112, 3, 16, 8, 0, 112, 113, 5, 37, 0, 0, 113, 15, 1, 0, 0, 0, 114, 115, 7, 0, 0, 0, 115, 17, 1, 0, 0, 0, 116, 117, 7, 1, 0, 0, 117, 19, 1, 0, 0, 0, 118, 125, 3, 22, 11, 0, 119, 125, 3, 24, 12, 0, 120, 125, 3, 26, 13, 0, 121, 125, 3, 28, 14, 0, 122, 125, 3, 30, 15, 0, 123, 125, 3, 32, 16, 0, 124, 118, 1, 0, 0, 0, 124, 119, 1, 0, 0, 0, 124, 120, 1, 0, 0, 0, 124, 121, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 123, 1, 0, 0, 0, 125, 21, 1, 0, 0, 0, 126, 127, 3, 16, 8, 0, 127, 130, 5, 37, 0, 0, 128, 129, 5, 14, 0, 0, 129, 131, 3, 34, 17, 0, 130, 128, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 5, 4, 0, 0, 133, 23, 1, 0, 0, 0, 134, 135, 5, 37, 0, 0, 135, 136, 5, 14, 0, 0, 136, 137, 3, 34, 17, 0, 137, 138, 5, 4, 0, 0, 138, 25, 1, 0, 0, 0, 139, 140, 5, 15, 0, 0, 140, 141, 5, 6, 0, 0, 141, 142, 3, 34, 17, 0, 142, 143, 5, 7, 0, 0, 143, 146, 3, 20, 10, 0, 144, 145, 5, 16, 0, 0, 145, 147, 3, 20, 10, 0, 146, 144, 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 147, 27, 1, 0, 0, 0, 148, 149, 5, 17, 0, 0, 149, 150, 5, 6, 0, 0, 150, 151, 3, 34, 17, 0, 151, 152, 5, 7, 0, 0, 152, 153, 3, 20, 10, 0, 153, 29, 1, 0, 0, 0, 154, 156, 5, 18, 0, 0, 155, 157, 3, 34, 17, 0, 156, 155, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 158, 1, 0, 0, 0, 158, 159, 5, 4, 0, 0, 159, 31, 1, 0, 0, 0, 160, 164, 5, 2, 0, 0, 161, 163, 3, 20, 10, 0, 162, 161, 1, 0, 0, 0, 163, 166, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 167, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 3, 0, 0, 168, 33, 1, 0, 0, 0, 169, 170, 6, 17, -1, 0, 170, 171, 5, 28, 0, 0, 171, 181, 3, 34, 17, 5, 172, 173, 5, 32, 0, 0, 173, 181, 3, 34, 17, 4, 174, 175, 5, 6, 0, 0, 175, 176, 3, 34, 17, 0, 176, 177, 5, 7, 0, 0, 177, 181, 1, 0, 0, 0, 178, 181, 3, 36, 18, 0, 179, 181, 5, 37, 0, 0, 180, 169, 1, 0, 0, 0, 180, 172, 1, 0, 0, 0, 180, 174, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 179, 1, 0, 0, 0, 181, 193, 1, 0, 0, 0, 182, 183, 10, 8, 0, 0, 183, 184, 7, 2, 0, 0, 184, 192, 3, 34, 17, 9, 185, 186, 10, 7, 0, 0, 186, 187, 7, 3, 0, 0, 187, 192, 3, 34, 17, 8, 188, 189, 10, 6, 0, 0, 189, 190, 7, 4, 0, 0, 190, 192, 3, 34, 17, 7, 191, 182, 1, 0, 0, 0, 191, 185, 1, 0, 0, 0, 191, 188, 1, 0, 0, 0, 192, 195, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 35, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 196, 200, 5, 36, 0, 0, 197, 200, 3, 38, 19, 0, 198, 200, 3, 40, 20, 0, 199, 196, 1, 0, 0, 0, 199, 197, 1, 0, 0, 0, 199, 198, 1, 0, 0, 0, 200, 37, 1, 0, 0, 0, 201, 202, 7, 5, 0, 0, 202, 39, 1, 0, 0, 0, 203, 204, 5, 35, 0, 0, 204, 205, 9, 0, 0, 0, 205, 206, 5, 35, 0, 0, 206, 41, 1, 0, 0, 0, 17, 45, 54, 62, 75, 82, 91, 98, 108, 124, 130, 146, 156, 164, 180, 191, 193, 199] \ No newline at end of file diff --git a/src/main/java/parser/generated/SimpleJavaBaseListener.java b/src/main/java/parser/generated/SimpleJavaBaseListener.java index 342f385..8b113f3 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; import org.antlr.v4.runtime.ParserRuleContext; @@ -168,18 +168,6 @@ public class SimpleJavaBaseListener implements SimpleJavaListener { *

The default implementation does nothing.

*/ @Override public void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVar(SimpleJavaParser.VarContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVar(SimpleJavaParser.VarContext ctx) { } /** * {@inheritDoc} * diff --git a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java index 4feb7ea..2bef07a 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; @@ -103,13 +103,6 @@ public class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implem * {@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 visitVar(SimpleJavaParser.VarContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * diff --git a/src/main/java/parser/generated/SimpleJavaLexer.java b/src/main/java/parser/generated/SimpleJavaLexer.java index 979b0a4..2f799ca 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/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; diff --git a/src/main/java/parser/generated/SimpleJavaListener.java b/src/main/java/parser/generated/SimpleJavaListener.java index 6debbf6..24f42d4 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; import org.antlr.v4.runtime.tree.ParseTreeListener; @@ -137,16 +137,6 @@ public interface SimpleJavaListener extends ParseTreeListener { * @param ctx the parse tree */ void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx); - /** - * Enter a parse tree produced by {@link SimpleJavaParser#var}. - * @param ctx the parse tree - */ - void enterVar(SimpleJavaParser.VarContext ctx); - /** - * Exit a parse tree produced by {@link SimpleJavaParser#var}. - * @param ctx the parse tree - */ - void exitVar(SimpleJavaParser.VarContext ctx); /** * Enter a parse tree produced by {@link SimpleJavaParser#ifStatement}. * @param ctx the parse tree diff --git a/src/main/java/parser/generated/SimpleJavaParser.java b/src/main/java/parser/generated/SimpleJavaParser.java index 5b14132..7251179 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/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; @@ -28,15 +28,15 @@ public class SimpleJavaParser extends Parser { RULE_fieldDeclaration = 3, RULE_methodDeclaration = 4, RULE_constructorDeclaration = 5, RULE_parameterList = 6, RULE_parameter = 7, RULE_type = 8, RULE_accessType = 9, RULE_statement = 10, RULE_variableDeclarationStatement = 11, RULE_assignmentStatement = 12, - RULE_var = 13, RULE_ifStatement = 14, RULE_whileStatement = 15, RULE_returnStatement = 16, - RULE_block = 17, RULE_expression = 18, RULE_literal = 19, RULE_booleanLiteral = 20, - RULE_charLiteral = 21; + RULE_ifStatement = 13, RULE_whileStatement = 14, RULE_returnStatement = 15, + RULE_block = 16, RULE_expression = 17, RULE_literal = 18, RULE_booleanLiteral = 19, + RULE_charLiteral = 20; private static String[] makeRuleNames() { return new String[] { "program", "classDeclaration", "memberDeclaration", "fieldDeclaration", "methodDeclaration", "constructorDeclaration", "parameterList", "parameter", "type", "accessType", "statement", "variableDeclarationStatement", "assignmentStatement", - "var", "ifStatement", "whileStatement", "returnStatement", "block", "expression", + "ifStatement", "whileStatement", "returnStatement", "block", "expression", "literal", "booleanLiteral", "charLiteral" }; } @@ -145,17 +145,17 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(45); + setState(43); _errHandler.sync(this); _la = _input.LA(1); do { { { - setState(44); + setState(42); classDeclaration(); } } - setState(47); + setState(45); _errHandler.sync(this); _la = _input.LA(1); } while ( _la==T__11 || _la==T__12 ); @@ -210,29 +210,29 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(49); + setState(47); accessType(); - setState(50); + setState(48); match(T__0); - setState(51); + setState(49); match(IDENTIFIER); - setState(52); + setState(50); match(T__1); - setState(56); + setState(54); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__11 || _la==T__12) { { { - setState(53); + setState(51); memberDeclaration(); } } - setState(58); + setState(56); _errHandler.sync(this); _la = _input.LA(1); } - setState(59); + setState(57); match(T__2); } } @@ -281,27 +281,27 @@ public class SimpleJavaParser extends Parser { MemberDeclarationContext _localctx = new MemberDeclarationContext(_ctx, getState()); enterRule(_localctx, 4, RULE_memberDeclaration); try { - setState(64); + setState(62); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { - setState(61); + setState(59); fieldDeclaration(); } break; case 2: enterOuterAlt(_localctx, 2); { - setState(62); + setState(60); methodDeclaration(); } break; case 3: enterOuterAlt(_localctx, 3); { - setState(63); + setState(61); constructorDeclaration(); } break; @@ -352,13 +352,13 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(66); + setState(64); accessType(); - setState(67); + setState(65); type(); - setState(68); + setState(66); match(IDENTIFIER); - setState(69); + setState(67); match(T__3); } } @@ -417,45 +417,45 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(71); + setState(69); accessType(); - setState(72); + setState(70); match(T__4); - setState(73); + setState(71); type(); - setState(74); + setState(72); match(IDENTIFIER); - setState(75); + setState(73); match(T__5); - setState(77); + setState(75); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) { { - setState(76); + setState(74); parameterList(); } } - setState(79); + setState(77); match(T__6); - setState(80); + setState(78); match(T__1); - setState(84); + setState(82); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 137439383044L) != 0)) { { { - setState(81); + setState(79); statement(); } } - setState(86); + setState(84); _errHandler.sync(this); _la = _input.LA(1); } - setState(87); + setState(85); match(T__2); } } @@ -511,41 +511,41 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(89); + setState(87); accessType(); - setState(90); + setState(88); match(IDENTIFIER); - setState(91); + setState(89); match(T__5); - setState(93); + setState(91); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) { { - setState(92); + setState(90); parameterList(); } } - setState(95); + setState(93); match(T__6); - setState(96); + setState(94); match(T__1); - setState(100); + setState(98); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 137439383044L) != 0)) { { { - setState(97); + setState(95); statement(); } } - setState(102); + setState(100); _errHandler.sync(this); _la = _input.LA(1); } - setState(103); + setState(101); match(T__2); } } @@ -594,21 +594,21 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(105); + setState(103); parameter(); - setState(110); + setState(108); _errHandler.sync(this); _la = _input.LA(1); while (_la==T__7) { { { - setState(106); + setState(104); match(T__7); - setState(107); + setState(105); parameter(); } } - setState(112); + setState(110); _errHandler.sync(this); _la = _input.LA(1); } @@ -656,9 +656,9 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(113); + setState(111); type(); - setState(114); + setState(112); match(IDENTIFIER); } } @@ -701,7 +701,7 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(116); + setState(114); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) ) { _errHandler.recoverInline(this); @@ -752,7 +752,7 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(118); + setState(116); _la = _input.LA(1); if ( !(_la==T__11 || _la==T__12) ) { _errHandler.recoverInline(this); @@ -818,7 +818,7 @@ public class SimpleJavaParser extends Parser { StatementContext _localctx = new StatementContext(_ctx, getState()); enterRule(_localctx, 20, RULE_statement); try { - setState(126); + setState(124); _errHandler.sync(this); switch (_input.LA(1)) { case T__8: @@ -826,42 +826,42 @@ public class SimpleJavaParser extends Parser { case T__10: enterOuterAlt(_localctx, 1); { - setState(120); + setState(118); variableDeclarationStatement(); } break; case IDENTIFIER: enterOuterAlt(_localctx, 2); { - setState(121); + setState(119); assignmentStatement(); } break; case T__14: enterOuterAlt(_localctx, 3); { - setState(122); + setState(120); ifStatement(); } break; case T__16: enterOuterAlt(_localctx, 4); { - setState(123); + setState(121); whileStatement(); } break; case T__17: enterOuterAlt(_localctx, 5); { - setState(124); + setState(122); returnStatement(); } break; case T__1: enterOuterAlt(_localctx, 6); { - setState(125); + setState(123); block(); } break; @@ -915,23 +915,23 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(128); + setState(126); type(); - setState(129); + setState(127); match(IDENTIFIER); - setState(132); + setState(130); _errHandler.sync(this); _la = _input.LA(1); if (_la==T__13) { { - setState(130); + setState(128); match(T__13); - setState(131); + setState(129); expression(0); } } - setState(134); + setState(132); match(T__3); } } @@ -948,9 +948,7 @@ public class SimpleJavaParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class AssignmentStatementContext extends ParserRuleContext { - public VarContext var() { - return getRuleContext(VarContext.class,0); - } + public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); } public ExpressionContext expression() { return getRuleContext(ExpressionContext.class,0); } @@ -979,57 +977,14 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(136); - var(); - setState(137); - match(T__13); - setState(138); - expression(0); - setState(139); - 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 VarContext extends ParserRuleContext { - public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); } - public VarContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_var; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterVar(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitVar(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor)visitor).visitVar(this); - else return visitor.visitChildren(this); - } - } - - public final VarContext var() throws RecognitionException { - VarContext _localctx = new VarContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_var); - try { - enterOuterAlt(_localctx, 1); - { - setState(141); + setState(134); match(IDENTIFIER); + setState(135); + match(T__13); + setState(136); + expression(0); + setState(137); + match(T__3); } } catch (RecognitionException re) { @@ -1075,28 +1030,28 @@ public class SimpleJavaParser extends Parser { public final IfStatementContext ifStatement() throws RecognitionException { IfStatementContext _localctx = new IfStatementContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_ifStatement); + enterRule(_localctx, 26, RULE_ifStatement); try { enterOuterAlt(_localctx, 1); { - setState(143); + setState(139); match(T__14); - setState(144); + setState(140); match(T__5); - setState(145); + setState(141); expression(0); - setState(146); + setState(142); match(T__6); - setState(147); + setState(143); statement(); - setState(150); + setState(146); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) { case 1: { - setState(148); + setState(144); match(T__15); - setState(149); + setState(145); statement(); } break; @@ -1143,19 +1098,19 @@ public class SimpleJavaParser extends Parser { public final WhileStatementContext whileStatement() throws RecognitionException { WhileStatementContext _localctx = new WhileStatementContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_whileStatement); + enterRule(_localctx, 28, RULE_whileStatement); try { enterOuterAlt(_localctx, 1); { - setState(152); + setState(148); match(T__16); - setState(153); + setState(149); match(T__5); - setState(154); + setState(150); expression(0); - setState(155); + setState(151); match(T__6); - setState(156); + setState(152); statement(); } } @@ -1196,24 +1151,24 @@ public class SimpleJavaParser extends Parser { public final ReturnStatementContext returnStatement() throws RecognitionException { ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_returnStatement); + enterRule(_localctx, 30, RULE_returnStatement); int _la; try { enterOuterAlt(_localctx, 1); { - setState(158); + setState(154); match(T__17); - setState(160); + setState(156); _errHandler.sync(this); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 270851375168L) != 0)) { { - setState(159); + setState(155); expression(0); } } - setState(162); + setState(158); match(T__3); } } @@ -1257,28 +1212,28 @@ public class SimpleJavaParser extends Parser { public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_block); + enterRule(_localctx, 32, RULE_block); int _la; try { enterOuterAlt(_localctx, 1); { - setState(164); + setState(160); match(T__1); - setState(168); + setState(164); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 137439383044L) != 0)) { { { - setState(165); + setState(161); statement(); } } - setState(170); + setState(166); _errHandler.sync(this); _la = _input.LA(1); } - setState(171); + setState(167); match(T__2); } } @@ -1333,39 +1288,39 @@ public class SimpleJavaParser extends Parser { int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; - int _startState = 36; - enterRecursionRule(_localctx, 36, RULE_expression, _p); + int _startState = 34; + enterRecursionRule(_localctx, 34, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); { - setState(184); + setState(180); _errHandler.sync(this); switch (_input.LA(1)) { case T__27: { - setState(174); + setState(170); match(T__27); - setState(175); + setState(171); expression(5); } break; case T__31: { - setState(176); + setState(172); match(T__31); - setState(177); + setState(173); expression(4); } break; case T__5: { - setState(178); + setState(174); match(T__5); - setState(179); + setState(175); expression(0); - setState(180); + setState(176); match(T__6); } break; @@ -1374,13 +1329,13 @@ public class SimpleJavaParser extends Parser { case T__34: case INTEGERLITERAL: { - setState(182); + setState(178); literal(); } break; case IDENTIFIER: { - setState(183); + setState(179); match(IDENTIFIER); } break; @@ -1388,7 +1343,7 @@ public class SimpleJavaParser extends Parser { throw new NoViableAltException(this); } _ctx.stop = _input.LT(-1); - setState(197); + setState(193); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,15,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -1396,16 +1351,16 @@ public class SimpleJavaParser extends Parser { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(195); + setState(191); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) { case 1: { _localctx = new ExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(186); + setState(182); if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); - setState(187); + setState(183); _la = _input.LA(1); if ( !(_la==T__18 || _la==T__19) ) { _errHandler.recoverInline(this); @@ -1415,7 +1370,7 @@ public class SimpleJavaParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(188); + setState(184); expression(9); } break; @@ -1423,9 +1378,9 @@ public class SimpleJavaParser extends Parser { { _localctx = new ExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(189); + setState(185); if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(190); + setState(186); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 132120576L) != 0)) ) { _errHandler.recoverInline(this); @@ -1435,7 +1390,7 @@ public class SimpleJavaParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(191); + setState(187); expression(8); } break; @@ -1443,9 +1398,9 @@ public class SimpleJavaParser extends Parser { { _localctx = new ExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(192); + setState(188); if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); - setState(193); + setState(189); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 4160749568L) != 0)) ) { _errHandler.recoverInline(this); @@ -1455,14 +1410,14 @@ public class SimpleJavaParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(194); + setState(190); expression(7); } break; } } } - setState(199); + setState(195); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,15,_ctx); } @@ -1509,15 +1464,15 @@ public class SimpleJavaParser extends Parser { public final LiteralContext literal() throws RecognitionException { LiteralContext _localctx = new LiteralContext(_ctx, getState()); - enterRule(_localctx, 38, RULE_literal); + enterRule(_localctx, 36, RULE_literal); try { - setState(203); + setState(199); _errHandler.sync(this); switch (_input.LA(1)) { case INTEGERLITERAL: enterOuterAlt(_localctx, 1); { - setState(200); + setState(196); match(INTEGERLITERAL); } break; @@ -1525,14 +1480,14 @@ public class SimpleJavaParser extends Parser { case T__33: enterOuterAlt(_localctx, 2); { - setState(201); + setState(197); booleanLiteral(); } break; case T__34: enterOuterAlt(_localctx, 3); { - setState(202); + setState(198); charLiteral(); } break; @@ -1574,12 +1529,12 @@ public class SimpleJavaParser extends Parser { public final BooleanLiteralContext booleanLiteral() throws RecognitionException { BooleanLiteralContext _localctx = new BooleanLiteralContext(_ctx, getState()); - enterRule(_localctx, 40, RULE_booleanLiteral); + enterRule(_localctx, 38, RULE_booleanLiteral); int _la; try { enterOuterAlt(_localctx, 1); { - setState(205); + setState(201); _la = _input.LA(1); if ( !(_la==T__32 || _la==T__33) ) { _errHandler.recoverInline(this); @@ -1625,15 +1580,15 @@ public class SimpleJavaParser extends Parser { public final CharLiteralContext charLiteral() throws RecognitionException { CharLiteralContext _localctx = new CharLiteralContext(_ctx, getState()); - enterRule(_localctx, 42, RULE_charLiteral); + enterRule(_localctx, 40, RULE_charLiteral); try { enterOuterAlt(_localctx, 1); { - setState(207); + setState(203); match(T__34); - setState(208); + setState(204); matchWildcard(); - setState(209); + setState(205); match(T__34); } } @@ -1650,7 +1605,7 @@ public class SimpleJavaParser extends Parser { public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 18: + case 17: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; @@ -1668,134 +1623,132 @@ public class SimpleJavaParser extends Parser { } public static final String _serializedATN = - "\u0004\u0001&\u00d4\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0004\u0001&\u00d0\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"+ - "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015"+ - "\u0001\u0000\u0004\u0000.\b\u0000\u000b\u0000\f\u0000/\u0001\u0001\u0001"+ - "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0005\u00017\b\u0001\n\u0001"+ - "\f\u0001:\t\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001"+ - "\u0002\u0003\u0002A\b\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001"+ - "\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ - "\u0004\u0001\u0004\u0003\u0004N\b\u0004\u0001\u0004\u0001\u0004\u0001"+ - "\u0004\u0005\u0004S\b\u0004\n\u0004\f\u0004V\t\u0004\u0001\u0004\u0001"+ - "\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0003\u0005^\b"+ - "\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0005\u0005c\b\u0005\n\u0005"+ - "\f\u0005f\t\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001"+ - "\u0006\u0005\u0006m\b\u0006\n\u0006\f\u0006p\t\u0006\u0001\u0007\u0001"+ - "\u0007\u0001\u0007\u0001\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\n\u0003\n\u007f\b\n\u0001\u000b\u0001\u000b\u0001"+ - "\u000b\u0001\u000b\u0003\u000b\u0085\b\u000b\u0001\u000b\u0001\u000b\u0001"+ - "\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e"+ - "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0003\u000e"+ - "\u0097\b\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ - "\u0001\u000f\u0001\u0010\u0001\u0010\u0003\u0010\u00a1\b\u0010\u0001\u0010"+ - "\u0001\u0010\u0001\u0011\u0001\u0011\u0005\u0011\u00a7\b\u0011\n\u0011"+ - "\f\u0011\u00aa\t\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012"+ - "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012"+ - "\u0001\u0012\u0001\u0012\u0001\u0012\u0003\u0012\u00b9\b\u0012\u0001\u0012"+ - "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012"+ - "\u0001\u0012\u0001\u0012\u0005\u0012\u00c4\b\u0012\n\u0012\f\u0012\u00c7"+ - "\t\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0003\u0013\u00cc\b\u0013"+ - "\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015"+ - "\u0001\u0015\u0000\u0001$\u0016\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010"+ - "\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$&(*\u0000\u0006\u0001\u0000"+ + "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0001\u0000\u0004\u0000"+ + ",\b\u0000\u000b\u0000\f\u0000-\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0001\u0001\u0005\u00015\b\u0001\n\u0001\f\u00018\t\u0001\u0001"+ + "\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0003\u0002?\b"+ + "\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001"+ + "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0003"+ + "\u0004L\b\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0005\u0004Q\b\u0004"+ + "\n\u0004\f\u0004T\t\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005"+ + "\u0001\u0005\u0001\u0005\u0003\u0005\\\b\u0005\u0001\u0005\u0001\u0005"+ + "\u0001\u0005\u0005\u0005a\b\u0005\n\u0005\f\u0005d\t\u0005\u0001\u0005"+ + "\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0005\u0006k\b\u0006"+ + "\n\u0006\f\u0006n\t\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b"+ + "\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ + "\n\u0003\n}\b\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0003"+ + "\u000b\u0083\b\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001"+ + "\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0003"+ + "\r\u0093\b\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000e\u0001\u000f\u0001\u000f\u0003\u000f\u009d\b\u000f\u0001\u000f"+ + "\u0001\u000f\u0001\u0010\u0001\u0010\u0005\u0010\u00a3\b\u0010\n\u0010"+ + "\f\u0010\u00a6\t\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0001\u0011\u0003\u0011\u00b5\b\u0011\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0005\u0011\u00c0\b\u0011\n\u0011\f\u0011\u00c3"+ + "\t\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0003\u0012\u00c8\b\u0012"+ + "\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014"+ + "\u0001\u0014\u0000\u0001\"\u0015\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010"+ + "\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$&(\u0000\u0006\u0001\u0000"+ "\t\u000b\u0001\u0000\f\r\u0001\u0000\u0013\u0014\u0001\u0000\u0015\u001a"+ - "\u0001\u0000\u001b\u001f\u0001\u0000!\"\u00d8\u0000-\u0001\u0000\u0000"+ - "\u0000\u00021\u0001\u0000\u0000\u0000\u0004@\u0001\u0000\u0000\u0000\u0006"+ - "B\u0001\u0000\u0000\u0000\bG\u0001\u0000\u0000\u0000\nY\u0001\u0000\u0000"+ - "\u0000\fi\u0001\u0000\u0000\u0000\u000eq\u0001\u0000\u0000\u0000\u0010"+ - "t\u0001\u0000\u0000\u0000\u0012v\u0001\u0000\u0000\u0000\u0014~\u0001"+ - "\u0000\u0000\u0000\u0016\u0080\u0001\u0000\u0000\u0000\u0018\u0088\u0001"+ - "\u0000\u0000\u0000\u001a\u008d\u0001\u0000\u0000\u0000\u001c\u008f\u0001"+ - "\u0000\u0000\u0000\u001e\u0098\u0001\u0000\u0000\u0000 \u009e\u0001\u0000"+ - "\u0000\u0000\"\u00a4\u0001\u0000\u0000\u0000$\u00b8\u0001\u0000\u0000"+ - "\u0000&\u00cb\u0001\u0000\u0000\u0000(\u00cd\u0001\u0000\u0000\u0000*"+ - "\u00cf\u0001\u0000\u0000\u0000,.\u0003\u0002\u0001\u0000-,\u0001\u0000"+ - "\u0000\u0000./\u0001\u0000\u0000\u0000/-\u0001\u0000\u0000\u0000/0\u0001"+ - "\u0000\u0000\u00000\u0001\u0001\u0000\u0000\u000012\u0003\u0012\t\u0000"+ - "23\u0005\u0001\u0000\u000034\u0005%\u0000\u000048\u0005\u0002\u0000\u0000"+ - "57\u0003\u0004\u0002\u000065\u0001\u0000\u0000\u00007:\u0001\u0000\u0000"+ - "\u000086\u0001\u0000\u0000\u000089\u0001\u0000\u0000\u00009;\u0001\u0000"+ - "\u0000\u0000:8\u0001\u0000\u0000\u0000;<\u0005\u0003\u0000\u0000<\u0003"+ - "\u0001\u0000\u0000\u0000=A\u0003\u0006\u0003\u0000>A\u0003\b\u0004\u0000"+ - "?A\u0003\n\u0005\u0000@=\u0001\u0000\u0000\u0000@>\u0001\u0000\u0000\u0000"+ - "@?\u0001\u0000\u0000\u0000A\u0005\u0001\u0000\u0000\u0000BC\u0003\u0012"+ - "\t\u0000CD\u0003\u0010\b\u0000DE\u0005%\u0000\u0000EF\u0005\u0004\u0000"+ - "\u0000F\u0007\u0001\u0000\u0000\u0000GH\u0003\u0012\t\u0000HI\u0005\u0005"+ - "\u0000\u0000IJ\u0003\u0010\b\u0000JK\u0005%\u0000\u0000KM\u0005\u0006"+ - "\u0000\u0000LN\u0003\f\u0006\u0000ML\u0001\u0000\u0000\u0000MN\u0001\u0000"+ - "\u0000\u0000NO\u0001\u0000\u0000\u0000OP\u0005\u0007\u0000\u0000PT\u0005"+ - "\u0002\u0000\u0000QS\u0003\u0014\n\u0000RQ\u0001\u0000\u0000\u0000SV\u0001"+ - "\u0000\u0000\u0000TR\u0001\u0000\u0000\u0000TU\u0001\u0000\u0000\u0000"+ - "UW\u0001\u0000\u0000\u0000VT\u0001\u0000\u0000\u0000WX\u0005\u0003\u0000"+ - "\u0000X\t\u0001\u0000\u0000\u0000YZ\u0003\u0012\t\u0000Z[\u0005%\u0000"+ - "\u0000[]\u0005\u0006\u0000\u0000\\^\u0003\f\u0006\u0000]\\\u0001\u0000"+ - "\u0000\u0000]^\u0001\u0000\u0000\u0000^_\u0001\u0000\u0000\u0000_`\u0005"+ - "\u0007\u0000\u0000`d\u0005\u0002\u0000\u0000ac\u0003\u0014\n\u0000ba\u0001"+ - "\u0000\u0000\u0000cf\u0001\u0000\u0000\u0000db\u0001\u0000\u0000\u0000"+ - "de\u0001\u0000\u0000\u0000eg\u0001\u0000\u0000\u0000fd\u0001\u0000\u0000"+ - "\u0000gh\u0005\u0003\u0000\u0000h\u000b\u0001\u0000\u0000\u0000in\u0003"+ - "\u000e\u0007\u0000jk\u0005\b\u0000\u0000km\u0003\u000e\u0007\u0000lj\u0001"+ - "\u0000\u0000\u0000mp\u0001\u0000\u0000\u0000nl\u0001\u0000\u0000\u0000"+ - "no\u0001\u0000\u0000\u0000o\r\u0001\u0000\u0000\u0000pn\u0001\u0000\u0000"+ - "\u0000qr\u0003\u0010\b\u0000rs\u0005%\u0000\u0000s\u000f\u0001\u0000\u0000"+ - "\u0000tu\u0007\u0000\u0000\u0000u\u0011\u0001\u0000\u0000\u0000vw\u0007"+ - "\u0001\u0000\u0000w\u0013\u0001\u0000\u0000\u0000x\u007f\u0003\u0016\u000b"+ - "\u0000y\u007f\u0003\u0018\f\u0000z\u007f\u0003\u001c\u000e\u0000{\u007f"+ - "\u0003\u001e\u000f\u0000|\u007f\u0003 \u0010\u0000}\u007f\u0003\"\u0011"+ - "\u0000~x\u0001\u0000\u0000\u0000~y\u0001\u0000\u0000\u0000~z\u0001\u0000"+ - "\u0000\u0000~{\u0001\u0000\u0000\u0000~|\u0001\u0000\u0000\u0000~}\u0001"+ - "\u0000\u0000\u0000\u007f\u0015\u0001\u0000\u0000\u0000\u0080\u0081\u0003"+ - "\u0010\b\u0000\u0081\u0084\u0005%\u0000\u0000\u0082\u0083\u0005\u000e"+ - "\u0000\u0000\u0083\u0085\u0003$\u0012\u0000\u0084\u0082\u0001\u0000\u0000"+ - "\u0000\u0084\u0085\u0001\u0000\u0000\u0000\u0085\u0086\u0001\u0000\u0000"+ - "\u0000\u0086\u0087\u0005\u0004\u0000\u0000\u0087\u0017\u0001\u0000\u0000"+ - "\u0000\u0088\u0089\u0003\u001a\r\u0000\u0089\u008a\u0005\u000e\u0000\u0000"+ - "\u008a\u008b\u0003$\u0012\u0000\u008b\u008c\u0005\u0004\u0000\u0000\u008c"+ - "\u0019\u0001\u0000\u0000\u0000\u008d\u008e\u0005%\u0000\u0000\u008e\u001b"+ - "\u0001\u0000\u0000\u0000\u008f\u0090\u0005\u000f\u0000\u0000\u0090\u0091"+ - "\u0005\u0006\u0000\u0000\u0091\u0092\u0003$\u0012\u0000\u0092\u0093\u0005"+ - "\u0007\u0000\u0000\u0093\u0096\u0003\u0014\n\u0000\u0094\u0095\u0005\u0010"+ - "\u0000\u0000\u0095\u0097\u0003\u0014\n\u0000\u0096\u0094\u0001\u0000\u0000"+ - "\u0000\u0096\u0097\u0001\u0000\u0000\u0000\u0097\u001d\u0001\u0000\u0000"+ - "\u0000\u0098\u0099\u0005\u0011\u0000\u0000\u0099\u009a\u0005\u0006\u0000"+ - "\u0000\u009a\u009b\u0003$\u0012\u0000\u009b\u009c\u0005\u0007\u0000\u0000"+ - "\u009c\u009d\u0003\u0014\n\u0000\u009d\u001f\u0001\u0000\u0000\u0000\u009e"+ - "\u00a0\u0005\u0012\u0000\u0000\u009f\u00a1\u0003$\u0012\u0000\u00a0\u009f"+ - "\u0001\u0000\u0000\u0000\u00a0\u00a1\u0001\u0000\u0000\u0000\u00a1\u00a2"+ - "\u0001\u0000\u0000\u0000\u00a2\u00a3\u0005\u0004\u0000\u0000\u00a3!\u0001"+ - "\u0000\u0000\u0000\u00a4\u00a8\u0005\u0002\u0000\u0000\u00a5\u00a7\u0003"+ - "\u0014\n\u0000\u00a6\u00a5\u0001\u0000\u0000\u0000\u00a7\u00aa\u0001\u0000"+ - "\u0000\u0000\u00a8\u00a6\u0001\u0000\u0000\u0000\u00a8\u00a9\u0001\u0000"+ - "\u0000\u0000\u00a9\u00ab\u0001\u0000\u0000\u0000\u00aa\u00a8\u0001\u0000"+ - "\u0000\u0000\u00ab\u00ac\u0005\u0003\u0000\u0000\u00ac#\u0001\u0000\u0000"+ - "\u0000\u00ad\u00ae\u0006\u0012\uffff\uffff\u0000\u00ae\u00af\u0005\u001c"+ - "\u0000\u0000\u00af\u00b9\u0003$\u0012\u0005\u00b0\u00b1\u0005 \u0000\u0000"+ - "\u00b1\u00b9\u0003$\u0012\u0004\u00b2\u00b3\u0005\u0006\u0000\u0000\u00b3"+ - "\u00b4\u0003$\u0012\u0000\u00b4\u00b5\u0005\u0007\u0000\u0000\u00b5\u00b9"+ - "\u0001\u0000\u0000\u0000\u00b6\u00b9\u0003&\u0013\u0000\u00b7\u00b9\u0005"+ - "%\u0000\u0000\u00b8\u00ad\u0001\u0000\u0000\u0000\u00b8\u00b0\u0001\u0000"+ - "\u0000\u0000\u00b8\u00b2\u0001\u0000\u0000\u0000\u00b8\u00b6\u0001\u0000"+ - "\u0000\u0000\u00b8\u00b7\u0001\u0000\u0000\u0000\u00b9\u00c5\u0001\u0000"+ - "\u0000\u0000\u00ba\u00bb\n\b\u0000\u0000\u00bb\u00bc\u0007\u0002\u0000"+ - "\u0000\u00bc\u00c4\u0003$\u0012\t\u00bd\u00be\n\u0007\u0000\u0000\u00be"+ - "\u00bf\u0007\u0003\u0000\u0000\u00bf\u00c4\u0003$\u0012\b\u00c0\u00c1"+ - "\n\u0006\u0000\u0000\u00c1\u00c2\u0007\u0004\u0000\u0000\u00c2\u00c4\u0003"+ - "$\u0012\u0007\u00c3\u00ba\u0001\u0000\u0000\u0000\u00c3\u00bd\u0001\u0000"+ - "\u0000\u0000\u00c3\u00c0\u0001\u0000\u0000\u0000\u00c4\u00c7\u0001\u0000"+ - "\u0000\u0000\u00c5\u00c3\u0001\u0000\u0000\u0000\u00c5\u00c6\u0001\u0000"+ - "\u0000\u0000\u00c6%\u0001\u0000\u0000\u0000\u00c7\u00c5\u0001\u0000\u0000"+ - "\u0000\u00c8\u00cc\u0005$\u0000\u0000\u00c9\u00cc\u0003(\u0014\u0000\u00ca"+ - "\u00cc\u0003*\u0015\u0000\u00cb\u00c8\u0001\u0000\u0000\u0000\u00cb\u00c9"+ - "\u0001\u0000\u0000\u0000\u00cb\u00ca\u0001\u0000\u0000\u0000\u00cc\'\u0001"+ - "\u0000\u0000\u0000\u00cd\u00ce\u0007\u0005\u0000\u0000\u00ce)\u0001\u0000"+ - "\u0000\u0000\u00cf\u00d0\u0005#\u0000\u0000\u00d0\u00d1\t\u0000\u0000"+ - "\u0000\u00d1\u00d2\u0005#\u0000\u0000\u00d2+\u0001\u0000\u0000\u0000\u0011"+ - "/8@MT]dn~\u0084\u0096\u00a0\u00a8\u00b8\u00c3\u00c5\u00cb"; + "\u0001\u0000\u001b\u001f\u0001\u0000!\"\u00d5\u0000+\u0001\u0000\u0000"+ + "\u0000\u0002/\u0001\u0000\u0000\u0000\u0004>\u0001\u0000\u0000\u0000\u0006"+ + "@\u0001\u0000\u0000\u0000\bE\u0001\u0000\u0000\u0000\nW\u0001\u0000\u0000"+ + "\u0000\fg\u0001\u0000\u0000\u0000\u000eo\u0001\u0000\u0000\u0000\u0010"+ + "r\u0001\u0000\u0000\u0000\u0012t\u0001\u0000\u0000\u0000\u0014|\u0001"+ + "\u0000\u0000\u0000\u0016~\u0001\u0000\u0000\u0000\u0018\u0086\u0001\u0000"+ + "\u0000\u0000\u001a\u008b\u0001\u0000\u0000\u0000\u001c\u0094\u0001\u0000"+ + "\u0000\u0000\u001e\u009a\u0001\u0000\u0000\u0000 \u00a0\u0001\u0000\u0000"+ + "\u0000\"\u00b4\u0001\u0000\u0000\u0000$\u00c7\u0001\u0000\u0000\u0000"+ + "&\u00c9\u0001\u0000\u0000\u0000(\u00cb\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/0\u0003\u0012\t\u000001\u0005\u0001\u0000\u000012\u0005%"+ + "\u0000\u000026\u0005\u0002\u0000\u000035\u0003\u0004\u0002\u000043\u0001"+ + "\u0000\u0000\u000058\u0001\u0000\u0000\u000064\u0001\u0000\u0000\u0000"+ + "67\u0001\u0000\u0000\u000079\u0001\u0000\u0000\u000086\u0001\u0000\u0000"+ + "\u00009:\u0005\u0003\u0000\u0000:\u0003\u0001\u0000\u0000\u0000;?\u0003"+ + "\u0006\u0003\u0000;\u0001"+ + "\u0000\u0000\u0000><\u0001\u0000\u0000\u0000>=\u0001\u0000\u0000\u0000"+ + "?\u0005\u0001\u0000\u0000\u0000@A\u0003\u0012\t\u0000AB\u0003\u0010\b"+ + "\u0000BC\u0005%\u0000\u0000CD\u0005\u0004\u0000\u0000D\u0007\u0001\u0000"+ + "\u0000\u0000EF\u0003\u0012\t\u0000FG\u0005\u0005\u0000\u0000GH\u0003\u0010"+ + "\b\u0000HI\u0005%\u0000\u0000IK\u0005\u0006\u0000\u0000JL\u0003\f\u0006"+ + "\u0000KJ\u0001\u0000\u0000\u0000KL\u0001\u0000\u0000\u0000LM\u0001\u0000"+ + "\u0000\u0000MN\u0005\u0007\u0000\u0000NR\u0005\u0002\u0000\u0000OQ\u0003"+ + "\u0014\n\u0000PO\u0001\u0000\u0000\u0000QT\u0001\u0000\u0000\u0000RP\u0001"+ + "\u0000\u0000\u0000RS\u0001\u0000\u0000\u0000SU\u0001\u0000\u0000\u0000"+ + "TR\u0001\u0000\u0000\u0000UV\u0005\u0003\u0000\u0000V\t\u0001\u0000\u0000"+ + "\u0000WX\u0003\u0012\t\u0000XY\u0005%\u0000\u0000Y[\u0005\u0006\u0000"+ + "\u0000Z\\\u0003\f\u0006\u0000[Z\u0001\u0000\u0000\u0000[\\\u0001\u0000"+ + "\u0000\u0000\\]\u0001\u0000\u0000\u0000]^\u0005\u0007\u0000\u0000^b\u0005"+ + "\u0002\u0000\u0000_a\u0003\u0014\n\u0000`_\u0001\u0000\u0000\u0000ad\u0001"+ + "\u0000\u0000\u0000b`\u0001\u0000\u0000\u0000bc\u0001\u0000\u0000\u0000"+ + "ce\u0001\u0000\u0000\u0000db\u0001\u0000\u0000\u0000ef\u0005\u0003\u0000"+ + "\u0000f\u000b\u0001\u0000\u0000\u0000gl\u0003\u000e\u0007\u0000hi\u0005"+ + "\b\u0000\u0000ik\u0003\u000e\u0007\u0000jh\u0001\u0000\u0000\u0000kn\u0001"+ + "\u0000\u0000\u0000lj\u0001\u0000\u0000\u0000lm\u0001\u0000\u0000\u0000"+ + "m\r\u0001\u0000\u0000\u0000nl\u0001\u0000\u0000\u0000op\u0003\u0010\b"+ + "\u0000pq\u0005%\u0000\u0000q\u000f\u0001\u0000\u0000\u0000rs\u0007\u0000"+ + "\u0000\u0000s\u0011\u0001\u0000\u0000\u0000tu\u0007\u0001\u0000\u0000"+ + "u\u0013\u0001\u0000\u0000\u0000v}\u0003\u0016\u000b\u0000w}\u0003\u0018"+ + "\f\u0000x}\u0003\u001a\r\u0000y}\u0003\u001c\u000e\u0000z}\u0003\u001e"+ + "\u000f\u0000{}\u0003 \u0010\u0000|v\u0001\u0000\u0000\u0000|w\u0001\u0000"+ + "\u0000\u0000|x\u0001\u0000\u0000\u0000|y\u0001\u0000\u0000\u0000|z\u0001"+ + "\u0000\u0000\u0000|{\u0001\u0000\u0000\u0000}\u0015\u0001\u0000\u0000"+ + "\u0000~\u007f\u0003\u0010\b\u0000\u007f\u0082\u0005%\u0000\u0000\u0080"+ + "\u0081\u0005\u000e\u0000\u0000\u0081\u0083\u0003\"\u0011\u0000\u0082\u0080"+ + "\u0001\u0000\u0000\u0000\u0082\u0083\u0001\u0000\u0000\u0000\u0083\u0084"+ + "\u0001\u0000\u0000\u0000\u0084\u0085\u0005\u0004\u0000\u0000\u0085\u0017"+ + "\u0001\u0000\u0000\u0000\u0086\u0087\u0005%\u0000\u0000\u0087\u0088\u0005"+ + "\u000e\u0000\u0000\u0088\u0089\u0003\"\u0011\u0000\u0089\u008a\u0005\u0004"+ + "\u0000\u0000\u008a\u0019\u0001\u0000\u0000\u0000\u008b\u008c\u0005\u000f"+ + "\u0000\u0000\u008c\u008d\u0005\u0006\u0000\u0000\u008d\u008e\u0003\"\u0011"+ + "\u0000\u008e\u008f\u0005\u0007\u0000\u0000\u008f\u0092\u0003\u0014\n\u0000"+ + "\u0090\u0091\u0005\u0010\u0000\u0000\u0091\u0093\u0003\u0014\n\u0000\u0092"+ + "\u0090\u0001\u0000\u0000\u0000\u0092\u0093\u0001\u0000\u0000\u0000\u0093"+ + "\u001b\u0001\u0000\u0000\u0000\u0094\u0095\u0005\u0011\u0000\u0000\u0095"+ + "\u0096\u0005\u0006\u0000\u0000\u0096\u0097\u0003\"\u0011\u0000\u0097\u0098"+ + "\u0005\u0007\u0000\u0000\u0098\u0099\u0003\u0014\n\u0000\u0099\u001d\u0001"+ + "\u0000\u0000\u0000\u009a\u009c\u0005\u0012\u0000\u0000\u009b\u009d\u0003"+ + "\"\u0011\u0000\u009c\u009b\u0001\u0000\u0000\u0000\u009c\u009d\u0001\u0000"+ + "\u0000\u0000\u009d\u009e\u0001\u0000\u0000\u0000\u009e\u009f\u0005\u0004"+ + "\u0000\u0000\u009f\u001f\u0001\u0000\u0000\u0000\u00a0\u00a4\u0005\u0002"+ + "\u0000\u0000\u00a1\u00a3\u0003\u0014\n\u0000\u00a2\u00a1\u0001\u0000\u0000"+ + "\u0000\u00a3\u00a6\u0001\u0000\u0000\u0000\u00a4\u00a2\u0001\u0000\u0000"+ + "\u0000\u00a4\u00a5\u0001\u0000\u0000\u0000\u00a5\u00a7\u0001\u0000\u0000"+ + "\u0000\u00a6\u00a4\u0001\u0000\u0000\u0000\u00a7\u00a8\u0005\u0003\u0000"+ + "\u0000\u00a8!\u0001\u0000\u0000\u0000\u00a9\u00aa\u0006\u0011\uffff\uffff"+ + "\u0000\u00aa\u00ab\u0005\u001c\u0000\u0000\u00ab\u00b5\u0003\"\u0011\u0005"+ + "\u00ac\u00ad\u0005 \u0000\u0000\u00ad\u00b5\u0003\"\u0011\u0004\u00ae"+ + "\u00af\u0005\u0006\u0000\u0000\u00af\u00b0\u0003\"\u0011\u0000\u00b0\u00b1"+ + "\u0005\u0007\u0000\u0000\u00b1\u00b5\u0001\u0000\u0000\u0000\u00b2\u00b5"+ + "\u0003$\u0012\u0000\u00b3\u00b5\u0005%\u0000\u0000\u00b4\u00a9\u0001\u0000"+ + "\u0000\u0000\u00b4\u00ac\u0001\u0000\u0000\u0000\u00b4\u00ae\u0001\u0000"+ + "\u0000\u0000\u00b4\u00b2\u0001\u0000\u0000\u0000\u00b4\u00b3\u0001\u0000"+ + "\u0000\u0000\u00b5\u00c1\u0001\u0000\u0000\u0000\u00b6\u00b7\n\b\u0000"+ + "\u0000\u00b7\u00b8\u0007\u0002\u0000\u0000\u00b8\u00c0\u0003\"\u0011\t"+ + "\u00b9\u00ba\n\u0007\u0000\u0000\u00ba\u00bb\u0007\u0003\u0000\u0000\u00bb"+ + "\u00c0\u0003\"\u0011\b\u00bc\u00bd\n\u0006\u0000\u0000\u00bd\u00be\u0007"+ + "\u0004\u0000\u0000\u00be\u00c0\u0003\"\u0011\u0007\u00bf\u00b6\u0001\u0000"+ + "\u0000\u0000\u00bf\u00b9\u0001\u0000\u0000\u0000\u00bf\u00bc\u0001\u0000"+ + "\u0000\u0000\u00c0\u00c3\u0001\u0000\u0000\u0000\u00c1\u00bf\u0001\u0000"+ + "\u0000\u0000\u00c1\u00c2\u0001\u0000\u0000\u0000\u00c2#\u0001\u0000\u0000"+ + "\u0000\u00c3\u00c1\u0001\u0000\u0000\u0000\u00c4\u00c8\u0005$\u0000\u0000"+ + "\u00c5\u00c8\u0003&\u0013\u0000\u00c6\u00c8\u0003(\u0014\u0000\u00c7\u00c4"+ + "\u0001\u0000\u0000\u0000\u00c7\u00c5\u0001\u0000\u0000\u0000\u00c7\u00c6"+ + "\u0001\u0000\u0000\u0000\u00c8%\u0001\u0000\u0000\u0000\u00c9\u00ca\u0007"+ + "\u0005\u0000\u0000\u00ca\'\u0001\u0000\u0000\u0000\u00cb\u00cc\u0005#"+ + "\u0000\u0000\u00cc\u00cd\t\u0000\u0000\u0000\u00cd\u00ce\u0005#\u0000"+ + "\u0000\u00ce)\u0001\u0000\u0000\u0000\u0011-6>KR[bl|\u0082\u0092\u009c"+ + "\u00a4\u00b4\u00bf\u00c1\u00c7"; 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 dd4ca0f..8a1f7fe 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/Documents/Github/JavaCompiler/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 +// Generated from C:/Users/ARB00075/Documents/DH/Compilerbau/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; import org.antlr.v4.runtime.tree.ParseTreeVisitor; @@ -88,12 +88,6 @@ public interface SimpleJavaVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx); - /** - * Visit a parse tree produced by {@link SimpleJavaParser#var}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitVar(SimpleJavaParser.VarContext ctx); /** * Visit a parse tree produced by {@link SimpleJavaParser#ifStatement}. * @param ctx the parse tree