From c2ce7ff80f7f0a754cfb9816e632f87b939a52aa Mon Sep 17 00:00:00 2001 From: Boolean-True Date: Tue, 7 May 2024 11:32:03 +0200 Subject: [PATCH] update Generators --- src/main/antlr/Decaf.g4 | 11 +- src/main/java/de/maishai/ASTGenerator.java | 34 +- src/main/java/de/maishai/BlockGenerator.java | 2 +- .../java/de/maishai/ExpressionGenerator.java | 87 +- .../java/de/maishai/StatementGenerator.java | 35 +- .../java/de/maishai/VariableGenerator.java | 6 +- src/main/java/de/maishai/antlr/Decaf.interp | 52 +- src/main/java/de/maishai/antlr/Decaf.tokens | 95 +- .../de/maishai/antlr/DecafBaseListener.java | 160 +- .../de/maishai/antlr/DecafBaseVisitor.java | 73 +- .../java/de/maishai/antlr/DecafLexer.interp | 61 +- .../java/de/maishai/antlr/DecafLexer.java | 307 ++-- .../java/de/maishai/antlr/DecafLexer.tokens | 95 +- .../java/de/maishai/antlr/DecafListener.java | 148 +- .../java/de/maishai/antlr/DecafParser.java | 1619 +++++++++++------ .../java/de/maishai/antlr/DecafVisitor.java | 87 +- .../java/de/maishai/ast/records/Class.java | 2 +- .../de/maishai/ast/records/Constructor.java | 2 +- .../de/maishai/ast/records/Expression.java | 2 +- .../java/de/maishai/ast/records/FieldId.java | 2 +- .../java/de/maishai/ast/records/Method.java | 2 +- .../java/de/maishai/ast/records/Node.java | 2 +- 22 files changed, 1937 insertions(+), 947 deletions(-) diff --git a/src/main/antlr/Decaf.g4 b/src/main/antlr/Decaf.g4 index 9812e82..aa2cb02 100644 --- a/src/main/antlr/Decaf.g4 +++ b/src/main/antlr/Decaf.g4 @@ -2,7 +2,7 @@ grammar Decaf; program : (class)+; -class : PUBLIC? 'class' id '{' (field | meth)* '}'; +class : PUBLIC? 'class' id '{' mainmeth (field | meth | constructor)* '}'; field : type id ';'; localVar : type id ';'; @@ -10,7 +10,7 @@ assignSign : ASSIGN | ADD_ASSIGN | SUB_ASSIGN | MUL_ASSIGN; returntype : type | VOID; type : INT | BOOL | CHAR; -meth : PUBLIC? returntype id '(' params? ')' block | mainmeth | constructor; +meth : PUBLIC? returntype id '(' params? ')' block; mainmeth : PUBLIC 'static' 'void' 'main' '(' 'String[] args' ')' block; constructor: PUBLIC? id '(' params? ')' block; params : param (',' param)*; @@ -43,12 +43,12 @@ expr : expr binaryOp expr #BinaryOperation | NULL #Null ; -binaryOp : ADD | SUB | MUL | GT | LT | GE | LE | EQ | NE | AND | OR | NOT; +binaryOp : ADD | SUB | MUL | GT | LT | GE | LE | EQ | NE | AND | OR; unaryOp : SUB | NOT; -fieldId : ('this' '.')? (recipient '.')* id; +fieldId : (THIS '.')? (recipient '.')* id; -methCall : ('this' '.')? (recipient '.')* methName; +methCall : (THIS '.')? (recipient '.')* methName; recipient : methName | id; methName : id '(' args? ')'; args : expr (',' expr)*; @@ -61,6 +61,7 @@ id : IDENTIFIER; PUBLIC : 'public'; NEW : 'new'; NULL : 'null'; +THIS : 'this'; SUB : '-'; ADD : '+'; diff --git a/src/main/java/de/maishai/ASTGenerator.java b/src/main/java/de/maishai/ASTGenerator.java index f498628..bb84987 100644 --- a/src/main/java/de/maishai/ASTGenerator.java +++ b/src/main/java/de/maishai/ASTGenerator.java @@ -20,20 +20,28 @@ public class ASTGenerator { } public static Class generateClass(DecafParser.ClassContext ctx) { - List vars = new ArrayList<>(); - if(ctx.var() != null){ - vars = ctx.var().stream().map(ASTGenerator::generateVariable).toList(); + Boolean isPublic = ctx.PUBLIC() != null; + List fields = new ArrayList<>(); + if(ctx.field() != null){ + fields = ctx.field().stream().map(ASTGenerator::generateFieldVariable).toList(); + } + MainMethod mainMethod = generateMainMethod(ctx.mainmeth()); + List constructors = new ArrayList<>(); + if(ctx.constructor() != null){ + constructors = ctx.constructor().stream().map(ASTGenerator::generateConstructor).toList(); } List meths = new ArrayList<>(); if(ctx.meth() != null){ meths = ctx.meth().stream().map(ASTGenerator::generateMethod).toList(); } Id classId = new Id(ctx.id().getText()); - return new Class(classId, vars, meths); + return new Class(isPublic, classId, fields, meths, mainMethod, constructors); } - public static LocalVariable generateVariable(DecafParser.VarContext ctx) { - return new VariableGenerator().visitVar(ctx); + public static Field generateFieldVariable(DecafParser.FieldContext ctx) { + Id id = new Id(ctx.id().getText()); + Type type = ASTGenerator.getType(ctx.type()); + return new Field(id, type); } public static Parameter generateParameter(DecafParser.ParamContext ctx) { @@ -41,13 +49,25 @@ public class ASTGenerator { } public static Method generateMethod(DecafParser.MethContext ctx) { + Boolean isPublic = ctx.PUBLIC() != null; List params = new ArrayList<>(); if(ctx.params() != null){ params = ctx.params().param().stream().map(ASTGenerator::generateParameter).toList(); } Block block = new BlockGenerator().visit(ctx.block()); Id methId = new Id(ctx.id().getText()); - return new Method(getReturnType(ctx.returntype()), methId, params, block); + return new Method(isPublic, getReturnType(ctx.returntype()), methId, params, block); + } + + public static Constructor generateConstructor(DecafParser.ConstructorContext ctx) { + Boolean isPublic = ctx.PUBLIC() != null; + List params = new ArrayList<>(); + if(ctx.params() != null){ + params = ctx.params().param().stream().map(ASTGenerator::generateParameter).toList(); + } + Block block = new BlockGenerator().visit(ctx.block()); + Id constructorId = new Id(ctx.id().getText()); + return new Constructor(isPublic, constructorId, params, block); } public static MainMethod generateMainMethod(DecafParser.MainmethContext ctx) { diff --git a/src/main/java/de/maishai/BlockGenerator.java b/src/main/java/de/maishai/BlockGenerator.java index daa1b6b..075ad1a 100644 --- a/src/main/java/de/maishai/BlockGenerator.java +++ b/src/main/java/de/maishai/BlockGenerator.java @@ -11,7 +11,7 @@ import java.util.List; public class BlockGenerator extends DecafBaseVisitor { @Override public Block visitBlock(DecafParser.BlockContext ctx) { - List vars = ctx.var().stream().map(var -> new VariableGenerator().visit(var)).toList(); + List vars = ctx.localVar().stream().map(var -> new VariableGenerator().visit(var)).toList(); List statements = ctx.stmt().stream().map(stmt -> new StatementGenerator().visit(stmt)).toList(); return new Block(vars, statements); } diff --git a/src/main/java/de/maishai/ExpressionGenerator.java b/src/main/java/de/maishai/ExpressionGenerator.java index da842f9..7270e45 100644 --- a/src/main/java/de/maishai/ExpressionGenerator.java +++ b/src/main/java/de/maishai/ExpressionGenerator.java @@ -2,6 +2,7 @@ package de.maishai; import de.maishai.antlr.DecafBaseVisitor; import de.maishai.antlr.DecafParser; +import de.maishai.ast.UnaryOperator; import de.maishai.ast.records.Expression; import de.maishai.ast.Operator; import de.maishai.ast.Type; @@ -16,6 +17,18 @@ public class ExpressionGenerator extends DecafBaseVisitor { return generateBinary(ctx); } + @Override + public Expression visitUnaryOperation(DecafParser.UnaryOperationContext ctx) { + Expression expr = this.visit(ctx.expr()); + if(ctx.unaryOp().NOT() != null){ + return new Unary(UnaryOperator.NOT, expr); + } + if(ctx.unaryOp().SUB() != null){ + return new Unary(UnaryOperator.SUB, expr); + } + throw new RuntimeException(); + } + @Override public Expression visitConstant(DecafParser.ConstantContext ctx) { return generateConstant(ctx.literal()); @@ -29,26 +42,26 @@ public class ExpressionGenerator extends DecafBaseVisitor { } @Override - public Expression visitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { - Id id = new Id(ctx.methCall().id().getText()); - List args = new ArrayList<>(); - for(var expr : ctx.methCall().args().expr()){ - Expression astExpr = expr.accept(this); - args.add(astExpr); + public Expression visitIdentifier(DecafParser.IdentifierContext ctx){ + Boolean isField = false; + if(ctx.fieldId().THIS() != null){ + isField = true; } - return new MethodCall(id, args); - } - - @Override - public Id visitIdentifier(DecafParser.IdentifierContext ctx){ - return new Id(ctx.getText()); + Expression recipient = null; + if(ctx.fieldId().recipient() != null){ + List recipientList = ctx.fieldId().recipient(); + recipient = generateRecipient(recipientList, null); + } + return new FieldId(isField, recipient, new Id(ctx.getText())); } public static Expression generateConstant(DecafParser.LiteralContext ctx){ if(ctx.NUMBER() != null) return new IntLiteral(Integer.valueOf(ctx.NUMBER().getText())); - if(ctx.boolean_() != null) - return new BoolLiteral(Boolean.valueOf(ctx.boolean_().getText())); + if(ctx.BOOLEANLITERAL() != null) + return new BoolLiteral(Boolean.valueOf(ctx.BOOLEANLITERAL().getText())); + if(ctx.CHARLITERAL() != null) + return new CharLiteral(ctx.CHARLITERAL().getText().charAt(0)); throw new RuntimeException(); } @@ -63,26 +76,35 @@ public class ExpressionGenerator extends DecafBaseVisitor { if(ctx.ADD() != null)return Operator.ADD; if(ctx.SUB() != null)return Operator.SUB; if(ctx.MUL() != null)return Operator.MUL; + if(ctx.GT() != null)return Operator.GT; + if(ctx.LT() != null)return Operator.LT; + if(ctx.GE() != null)return Operator.GE; + if(ctx.LE() != null)return Operator.LE; + if(ctx.EQ() != null)return Operator.EQ; + if(ctx.NE() != null)return Operator.NE; + if(ctx.AND() != null)return Operator.AND; + if(ctx.OR() != null)return Operator.OR; throw new RuntimeException(); } - //StatementExpression - @Override - public Expression visitAssign(DecafParser.AssignContext ctx) { - Id id = new Id(ctx.id().getText()); - Expression expr = this.visit(ctx.expr()); - return new Assignment(id, expr); - } - @Override public Expression visitMethodCall(DecafParser.MethodCallContext ctx) { - Id id = new Id(ctx.methCall().id().getText()); + Boolean isField = false; + if(ctx.methCall().THIS() != null){ + isField = true; + } + Expression recipient = null; + if(ctx.methCall().recipient() != null){ + List recipientList = ctx.methCall().recipient(); + recipient = generateRecipient(recipientList, null); + } + Id id = new Id(ctx.methCall().methName().id().getText()); List args = new ArrayList<>(); - for(var expr : ctx.methCall().args().expr()){ + for(var expr : ctx.methCall().methName().args().expr()){ Expression astExpr = expr.accept(this); args.add(astExpr); } - return new MethodCall(id, args); + return new MethodCall(isField, recipient, id, args); } @Override @@ -95,4 +117,19 @@ public class ExpressionGenerator extends DecafBaseVisitor { } return new New(type, args); } + + public static Expression generateRecipient(List ctxList, Expression recipient){ + if(ctxList.isEmpty()){ + return recipient; + } + DecafParser.RecipientContext ctx = ctxList.get(0); + ctxList.remove(0); + Id id = new Id(ctx.methName().id().getText()); + List args = new ArrayList<>(); + for(var expr : ctx.methName().args().expr()){ + Expression astExpr = expr.accept(new ExpressionGenerator()); + args.add(astExpr); + } + return new MethodCall(null, generateRecipient(ctxList, recipient), id, args); + } } diff --git a/src/main/java/de/maishai/StatementGenerator.java b/src/main/java/de/maishai/StatementGenerator.java index 4ba4c62..0115640 100644 --- a/src/main/java/de/maishai/StatementGenerator.java +++ b/src/main/java/de/maishai/StatementGenerator.java @@ -2,6 +2,7 @@ package de.maishai; import de.maishai.antlr.DecafBaseVisitor; import de.maishai.antlr.DecafParser; +import de.maishai.ast.AssignSign; import de.maishai.ast.records.Expression; import de.maishai.ast.records.Statement; import de.maishai.ast.Type; @@ -65,23 +66,33 @@ public class StatementGenerator extends DecafBaseVisitor { return new Continue(); } - //StatementExpression @Override - public Statement visitAssign(DecafParser.AssignContext ctx) { + public Statement visitAssignment(DecafParser.AssignmentContext ctx) { Id id = new Id(ctx.id().getText()); + AssignSign sign = getAssignSign(ctx.assignSign()); Expression expr = new ExpressionGenerator().visit(ctx.expr()); - return new Assignment(id, expr); + return new Assignment(id, sign, expr); } + //StatementExpression @Override public Statement visitMethodCall(DecafParser.MethodCallContext ctx) { - Id id = new Id(ctx.methCall().id().getText()); + Boolean isField = false; + if(ctx.methCall().THIS() != null){ + isField = true; + } + Expression recipient = null; + if(ctx.methCall().recipient() != null){ + List recipientList = ctx.methCall().recipient(); + recipient = new ExpressionGenerator().generateRecipient(recipientList, null); + } + Id id = new Id(ctx.methCall().methName().id().getText()); List args = new ArrayList<>(); - for(var expr : ctx.methCall().args().expr()){ + for(var expr : ctx.methCall().methName().args().expr()){ Expression astExpr = expr.accept(new ExpressionGenerator()); args.add(astExpr); } - return new MethodCall(id, args); + return new MethodCall(isField, recipient, id, args); } @Override @@ -94,4 +105,16 @@ public class StatementGenerator extends DecafBaseVisitor { } return new New(type, args); } + + public static AssignSign getAssignSign(DecafParser.AssignSignContext ctx){ + if(ctx.ASSIGN() != null) + return AssignSign.ASSIGN; + if(ctx.ADD_ASSIGN() != null) + return AssignSign.ADD_ASSIGN; + if(ctx.SUB_ASSIGN() != null) + return AssignSign.SUB_ASSIGN; + if(ctx.MUL_ASSIGN() != null) + return AssignSign.MUL_ASSIGN; + throw new RuntimeException(); + } } diff --git a/src/main/java/de/maishai/VariableGenerator.java b/src/main/java/de/maishai/VariableGenerator.java index f2dc523..a4de07f 100644 --- a/src/main/java/de/maishai/VariableGenerator.java +++ b/src/main/java/de/maishai/VariableGenerator.java @@ -10,11 +10,9 @@ import de.maishai.ast.records.LocalVariable; public class VariableGenerator extends DecafBaseVisitor { @Override - public LocalVariable visitVar(DecafParser.VarContext ctx) { + public LocalVariable visitLocalVar(DecafParser.LocalVarContext ctx) { Id id = new Id(ctx.id().getText()); Type type = ASTGenerator.getType(ctx.type()); - if(ctx.expr() != null) - return new LocalVariable(id, type, new ExpressionGenerator().visit(ctx.expr())); - return new LocalVariable(id, type, null); + return new LocalVariable(id, type); } } diff --git a/src/main/java/de/maishai/antlr/Decaf.interp b/src/main/java/de/maishai/antlr/Decaf.interp index 2171e2e..d290ca0 100644 --- a/src/main/java/de/maishai/antlr/Decaf.interp +++ b/src/main/java/de/maishai/antlr/Decaf.interp @@ -4,7 +4,6 @@ null '{' '}' ';' -'=' '(' ')' 'static' @@ -19,16 +18,32 @@ null 'return' 'break' 'continue' -'true' -'false' +'.' 'public' 'new' +'null' +'this' '-' '+' '*' +'>' +'<' +'>=' +'<=' +'==' +'!=' +'&&' +'||' +'=' +'+=' +'-=' +'*=' +'!' 'int' 'boolean' 'void' +'char' +null null null null @@ -55,17 +70,32 @@ null null null null -null -null PUBLIC NEW +NULL +THIS SUB ADD MUL +GT +LT +GE +LE +EQ +NE +AND +OR +ASSIGN +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +NOT INT BOOL VOID CHAR +BOOLEANLITERAL +CHARLITERAL IDENTIFIER NUMBER WS @@ -73,11 +103,14 @@ WS rule names: program class -var +field +localVar +assignSign returntype type meth mainmeth +constructor params param block @@ -85,12 +118,15 @@ stmt stmtexpr expr binaryOp +unaryOp +fieldId methCall +recipient +methName args literal -boolean id atn: -[4, 1, 33, 231, 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, 3, 1, 45, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 52, 8, 1, 10, 1, 12, 1, 55, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 69, 8, 2, 1, 3, 1, 3, 3, 3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 3, 5, 78, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 84, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 90, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 5, 7, 104, 8, 7, 10, 7, 12, 7, 107, 9, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 5, 9, 115, 8, 9, 10, 9, 12, 9, 118, 9, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 129, 8, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 165, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 179, 8, 11, 1, 11, 1, 11, 3, 11, 183, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 194, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 200, 8, 12, 10, 12, 12, 12, 203, 9, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 3, 14, 210, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 217, 8, 15, 10, 15, 12, 15, 220, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 225, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 0, 1, 24, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 3, 2, 0, 27, 28, 30, 30, 1, 0, 24, 26, 1, 0, 20, 21, 244, 0, 39, 1, 0, 0, 0, 2, 44, 1, 0, 0, 0, 4, 68, 1, 0, 0, 0, 6, 72, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 89, 1, 0, 0, 0, 12, 91, 1, 0, 0, 0, 14, 100, 1, 0, 0, 0, 16, 108, 1, 0, 0, 0, 18, 111, 1, 0, 0, 0, 20, 164, 1, 0, 0, 0, 22, 182, 1, 0, 0, 0, 24, 193, 1, 0, 0, 0, 26, 204, 1, 0, 0, 0, 28, 206, 1, 0, 0, 0, 30, 213, 1, 0, 0, 0, 32, 224, 1, 0, 0, 0, 34, 226, 1, 0, 0, 0, 36, 228, 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, 45, 5, 22, 0, 0, 44, 43, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 47, 5, 1, 0, 0, 47, 48, 3, 36, 18, 0, 48, 53, 5, 2, 0, 0, 49, 52, 3, 4, 2, 0, 50, 52, 3, 10, 5, 0, 51, 49, 1, 0, 0, 0, 51, 50, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 57, 5, 3, 0, 0, 57, 3, 1, 0, 0, 0, 58, 59, 3, 8, 4, 0, 59, 60, 3, 36, 18, 0, 60, 61, 5, 4, 0, 0, 61, 69, 1, 0, 0, 0, 62, 63, 3, 8, 4, 0, 63, 64, 3, 36, 18, 0, 64, 65, 5, 5, 0, 0, 65, 66, 3, 24, 12, 0, 66, 67, 5, 4, 0, 0, 67, 69, 1, 0, 0, 0, 68, 58, 1, 0, 0, 0, 68, 62, 1, 0, 0, 0, 69, 5, 1, 0, 0, 0, 70, 73, 3, 8, 4, 0, 71, 73, 5, 29, 0, 0, 72, 70, 1, 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 78, 5, 22, 0, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 80, 3, 6, 3, 0, 80, 81, 3, 36, 18, 0, 81, 83, 5, 6, 0, 0, 82, 84, 3, 14, 7, 0, 83, 82, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 86, 5, 7, 0, 0, 86, 87, 3, 18, 9, 0, 87, 90, 1, 0, 0, 0, 88, 90, 3, 12, 6, 0, 89, 77, 1, 0, 0, 0, 89, 88, 1, 0, 0, 0, 90, 11, 1, 0, 0, 0, 91, 92, 5, 22, 0, 0, 92, 93, 5, 8, 0, 0, 93, 94, 5, 29, 0, 0, 94, 95, 5, 9, 0, 0, 95, 96, 5, 6, 0, 0, 96, 97, 5, 10, 0, 0, 97, 98, 5, 7, 0, 0, 98, 99, 3, 18, 9, 0, 99, 13, 1, 0, 0, 0, 100, 105, 3, 16, 8, 0, 101, 102, 5, 11, 0, 0, 102, 104, 3, 16, 8, 0, 103, 101, 1, 0, 0, 0, 104, 107, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 15, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 108, 109, 3, 8, 4, 0, 109, 110, 3, 36, 18, 0, 110, 17, 1, 0, 0, 0, 111, 116, 5, 2, 0, 0, 112, 115, 3, 4, 2, 0, 113, 115, 3, 20, 10, 0, 114, 112, 1, 0, 0, 0, 114, 113, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 119, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, 120, 5, 3, 0, 0, 120, 19, 1, 0, 0, 0, 121, 122, 5, 12, 0, 0, 122, 123, 5, 6, 0, 0, 123, 124, 3, 24, 12, 0, 124, 125, 5, 7, 0, 0, 125, 128, 3, 18, 9, 0, 126, 127, 5, 13, 0, 0, 127, 129, 3, 18, 9, 0, 128, 126, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 165, 1, 0, 0, 0, 130, 131, 5, 14, 0, 0, 131, 132, 5, 6, 0, 0, 132, 133, 3, 24, 12, 0, 133, 134, 5, 4, 0, 0, 134, 135, 3, 24, 12, 0, 135, 136, 5, 4, 0, 0, 136, 137, 3, 24, 12, 0, 137, 138, 5, 7, 0, 0, 138, 139, 3, 18, 9, 0, 139, 165, 1, 0, 0, 0, 140, 141, 5, 15, 0, 0, 141, 142, 5, 6, 0, 0, 142, 143, 3, 24, 12, 0, 143, 144, 5, 7, 0, 0, 144, 145, 3, 18, 9, 0, 145, 165, 1, 0, 0, 0, 146, 147, 5, 16, 0, 0, 147, 148, 3, 18, 9, 0, 148, 149, 5, 15, 0, 0, 149, 150, 5, 6, 0, 0, 150, 151, 3, 24, 12, 0, 151, 152, 5, 7, 0, 0, 152, 165, 1, 0, 0, 0, 153, 154, 5, 17, 0, 0, 154, 155, 3, 24, 12, 0, 155, 156, 5, 4, 0, 0, 156, 165, 1, 0, 0, 0, 157, 158, 5, 17, 0, 0, 158, 165, 5, 4, 0, 0, 159, 160, 5, 18, 0, 0, 160, 165, 5, 4, 0, 0, 161, 162, 5, 19, 0, 0, 162, 165, 5, 4, 0, 0, 163, 165, 3, 22, 11, 0, 164, 121, 1, 0, 0, 0, 164, 130, 1, 0, 0, 0, 164, 140, 1, 0, 0, 0, 164, 146, 1, 0, 0, 0, 164, 153, 1, 0, 0, 0, 164, 157, 1, 0, 0, 0, 164, 159, 1, 0, 0, 0, 164, 161, 1, 0, 0, 0, 164, 163, 1, 0, 0, 0, 165, 21, 1, 0, 0, 0, 166, 167, 3, 36, 18, 0, 167, 168, 5, 5, 0, 0, 168, 169, 3, 24, 12, 0, 169, 170, 5, 4, 0, 0, 170, 183, 1, 0, 0, 0, 171, 172, 3, 28, 14, 0, 172, 173, 5, 4, 0, 0, 173, 183, 1, 0, 0, 0, 174, 175, 5, 23, 0, 0, 175, 176, 3, 8, 4, 0, 176, 178, 5, 6, 0, 0, 177, 179, 3, 30, 15, 0, 178, 177, 1, 0, 0, 0, 178, 179, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 181, 5, 7, 0, 0, 181, 183, 1, 0, 0, 0, 182, 166, 1, 0, 0, 0, 182, 171, 1, 0, 0, 0, 182, 174, 1, 0, 0, 0, 183, 23, 1, 0, 0, 0, 184, 185, 6, 12, -1, 0, 185, 194, 3, 32, 16, 0, 186, 187, 5, 6, 0, 0, 187, 188, 3, 24, 12, 0, 188, 189, 5, 7, 0, 0, 189, 194, 1, 0, 0, 0, 190, 194, 3, 28, 14, 0, 191, 194, 3, 36, 18, 0, 192, 194, 3, 22, 11, 0, 193, 184, 1, 0, 0, 0, 193, 186, 1, 0, 0, 0, 193, 190, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 193, 192, 1, 0, 0, 0, 194, 201, 1, 0, 0, 0, 195, 196, 10, 6, 0, 0, 196, 197, 3, 26, 13, 0, 197, 198, 3, 24, 12, 7, 198, 200, 1, 0, 0, 0, 199, 195, 1, 0, 0, 0, 200, 203, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 25, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 204, 205, 7, 1, 0, 0, 205, 27, 1, 0, 0, 0, 206, 207, 3, 36, 18, 0, 207, 209, 5, 6, 0, 0, 208, 210, 3, 30, 15, 0, 209, 208, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 5, 7, 0, 0, 212, 29, 1, 0, 0, 0, 213, 218, 3, 24, 12, 0, 214, 215, 5, 11, 0, 0, 215, 217, 3, 24, 12, 0, 216, 214, 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 31, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 225, 5, 32, 0, 0, 222, 225, 3, 34, 17, 0, 223, 225, 5, 30, 0, 0, 224, 221, 1, 0, 0, 0, 224, 222, 1, 0, 0, 0, 224, 223, 1, 0, 0, 0, 225, 33, 1, 0, 0, 0, 226, 227, 7, 2, 0, 0, 227, 35, 1, 0, 0, 0, 228, 229, 5, 31, 0, 0, 229, 37, 1, 0, 0, 0, 21, 41, 44, 51, 53, 68, 72, 77, 83, 89, 105, 114, 116, 128, 164, 178, 182, 193, 201, 209, 218, 224] \ No newline at end of file +[4, 1, 48, 283, 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, 1, 0, 4, 0, 52, 8, 0, 11, 0, 12, 0, 53, 1, 1, 3, 1, 57, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 66, 8, 1, 10, 1, 12, 1, 69, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 85, 8, 5, 1, 6, 1, 6, 1, 7, 3, 7, 90, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 96, 8, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 3, 9, 111, 8, 9, 1, 9, 1, 9, 1, 9, 3, 9, 116, 8, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 5, 10, 124, 8, 10, 10, 10, 12, 10, 127, 9, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 135, 8, 12, 10, 12, 12, 12, 138, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 149, 8, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 192, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 199, 8, 14, 1, 14, 1, 14, 3, 14, 203, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 217, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 223, 8, 15, 10, 15, 12, 15, 226, 9, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 234, 8, 18, 1, 18, 1, 18, 1, 18, 5, 18, 239, 8, 18, 10, 18, 12, 18, 242, 9, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 248, 8, 19, 1, 19, 1, 19, 1, 19, 5, 19, 253, 8, 19, 10, 19, 12, 19, 256, 9, 19, 1, 19, 1, 19, 1, 20, 1, 20, 3, 20, 262, 8, 20, 1, 21, 1, 21, 1, 21, 3, 21, 267, 8, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 5, 22, 274, 8, 22, 10, 22, 12, 22, 277, 9, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 0, 1, 30, 25, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 0, 5, 1, 0, 35, 38, 2, 0, 40, 41, 43, 43, 1, 0, 24, 34, 2, 0, 24, 24, 39, 39, 2, 0, 44, 45, 47, 47, 295, 0, 51, 1, 0, 0, 0, 2, 56, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 76, 1, 0, 0, 0, 8, 80, 1, 0, 0, 0, 10, 84, 1, 0, 0, 0, 12, 86, 1, 0, 0, 0, 14, 89, 1, 0, 0, 0, 16, 100, 1, 0, 0, 0, 18, 110, 1, 0, 0, 0, 20, 120, 1, 0, 0, 0, 22, 128, 1, 0, 0, 0, 24, 131, 1, 0, 0, 0, 26, 191, 1, 0, 0, 0, 28, 202, 1, 0, 0, 0, 30, 216, 1, 0, 0, 0, 32, 227, 1, 0, 0, 0, 34, 229, 1, 0, 0, 0, 36, 233, 1, 0, 0, 0, 38, 247, 1, 0, 0, 0, 40, 261, 1, 0, 0, 0, 42, 263, 1, 0, 0, 0, 44, 270, 1, 0, 0, 0, 46, 278, 1, 0, 0, 0, 48, 280, 1, 0, 0, 0, 50, 52, 3, 2, 1, 0, 51, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 1, 1, 0, 0, 0, 55, 57, 5, 20, 0, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 59, 5, 1, 0, 0, 59, 60, 3, 48, 24, 0, 60, 61, 5, 2, 0, 0, 61, 67, 3, 16, 8, 0, 62, 66, 3, 4, 2, 0, 63, 66, 3, 14, 7, 0, 64, 66, 3, 18, 9, 0, 65, 62, 1, 0, 0, 0, 65, 63, 1, 0, 0, 0, 65, 64, 1, 0, 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 5, 3, 0, 0, 71, 3, 1, 0, 0, 0, 72, 73, 3, 12, 6, 0, 73, 74, 3, 48, 24, 0, 74, 75, 5, 4, 0, 0, 75, 5, 1, 0, 0, 0, 76, 77, 3, 12, 6, 0, 77, 78, 3, 48, 24, 0, 78, 79, 5, 4, 0, 0, 79, 7, 1, 0, 0, 0, 80, 81, 7, 0, 0, 0, 81, 9, 1, 0, 0, 0, 82, 85, 3, 12, 6, 0, 83, 85, 5, 42, 0, 0, 84, 82, 1, 0, 0, 0, 84, 83, 1, 0, 0, 0, 85, 11, 1, 0, 0, 0, 86, 87, 7, 1, 0, 0, 87, 13, 1, 0, 0, 0, 88, 90, 5, 20, 0, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 3, 10, 5, 0, 92, 93, 3, 48, 24, 0, 93, 95, 5, 5, 0, 0, 94, 96, 3, 20, 10, 0, 95, 94, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3, 24, 12, 0, 99, 15, 1, 0, 0, 0, 100, 101, 5, 20, 0, 0, 101, 102, 5, 7, 0, 0, 102, 103, 5, 42, 0, 0, 103, 104, 5, 8, 0, 0, 104, 105, 5, 5, 0, 0, 105, 106, 5, 9, 0, 0, 106, 107, 5, 6, 0, 0, 107, 108, 3, 24, 12, 0, 108, 17, 1, 0, 0, 0, 109, 111, 5, 20, 0, 0, 110, 109, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 113, 3, 48, 24, 0, 113, 115, 5, 5, 0, 0, 114, 116, 3, 20, 10, 0, 115, 114, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 118, 5, 6, 0, 0, 118, 119, 3, 24, 12, 0, 119, 19, 1, 0, 0, 0, 120, 125, 3, 22, 11, 0, 121, 122, 5, 10, 0, 0, 122, 124, 3, 22, 11, 0, 123, 121, 1, 0, 0, 0, 124, 127, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 21, 1, 0, 0, 0, 127, 125, 1, 0, 0, 0, 128, 129, 3, 12, 6, 0, 129, 130, 3, 48, 24, 0, 130, 23, 1, 0, 0, 0, 131, 136, 5, 2, 0, 0, 132, 135, 3, 6, 3, 0, 133, 135, 3, 26, 13, 0, 134, 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 138, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 137, 1, 0, 0, 0, 137, 139, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 139, 140, 5, 3, 0, 0, 140, 25, 1, 0, 0, 0, 141, 142, 5, 11, 0, 0, 142, 143, 5, 5, 0, 0, 143, 144, 3, 30, 15, 0, 144, 145, 5, 6, 0, 0, 145, 148, 3, 24, 12, 0, 146, 147, 5, 12, 0, 0, 147, 149, 3, 24, 12, 0, 148, 146, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 192, 1, 0, 0, 0, 150, 151, 5, 13, 0, 0, 151, 152, 5, 5, 0, 0, 152, 153, 3, 30, 15, 0, 153, 154, 5, 4, 0, 0, 154, 155, 3, 30, 15, 0, 155, 156, 5, 4, 0, 0, 156, 157, 3, 30, 15, 0, 157, 158, 5, 6, 0, 0, 158, 159, 3, 24, 12, 0, 159, 192, 1, 0, 0, 0, 160, 161, 5, 14, 0, 0, 161, 162, 5, 5, 0, 0, 162, 163, 3, 30, 15, 0, 163, 164, 5, 6, 0, 0, 164, 165, 3, 24, 12, 0, 165, 192, 1, 0, 0, 0, 166, 167, 5, 15, 0, 0, 167, 168, 3, 24, 12, 0, 168, 169, 5, 14, 0, 0, 169, 170, 5, 5, 0, 0, 170, 171, 3, 30, 15, 0, 171, 172, 5, 6, 0, 0, 172, 192, 1, 0, 0, 0, 173, 174, 5, 16, 0, 0, 174, 175, 3, 30, 15, 0, 175, 176, 5, 4, 0, 0, 176, 192, 1, 0, 0, 0, 177, 178, 5, 16, 0, 0, 178, 192, 5, 4, 0, 0, 179, 180, 5, 17, 0, 0, 180, 192, 5, 4, 0, 0, 181, 182, 5, 18, 0, 0, 182, 192, 5, 4, 0, 0, 183, 184, 3, 48, 24, 0, 184, 185, 3, 8, 4, 0, 185, 186, 3, 30, 15, 0, 186, 187, 5, 4, 0, 0, 187, 192, 1, 0, 0, 0, 188, 189, 3, 28, 14, 0, 189, 190, 5, 4, 0, 0, 190, 192, 1, 0, 0, 0, 191, 141, 1, 0, 0, 0, 191, 150, 1, 0, 0, 0, 191, 160, 1, 0, 0, 0, 191, 166, 1, 0, 0, 0, 191, 173, 1, 0, 0, 0, 191, 177, 1, 0, 0, 0, 191, 179, 1, 0, 0, 0, 191, 181, 1, 0, 0, 0, 191, 183, 1, 0, 0, 0, 191, 188, 1, 0, 0, 0, 192, 27, 1, 0, 0, 0, 193, 203, 3, 38, 19, 0, 194, 195, 5, 21, 0, 0, 195, 196, 3, 12, 6, 0, 196, 198, 5, 5, 0, 0, 197, 199, 3, 44, 22, 0, 198, 197, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 201, 5, 6, 0, 0, 201, 203, 1, 0, 0, 0, 202, 193, 1, 0, 0, 0, 202, 194, 1, 0, 0, 0, 203, 29, 1, 0, 0, 0, 204, 205, 6, 15, -1, 0, 205, 206, 3, 34, 17, 0, 206, 207, 3, 30, 15, 6, 207, 217, 1, 0, 0, 0, 208, 217, 3, 46, 23, 0, 209, 210, 5, 5, 0, 0, 210, 211, 3, 30, 15, 0, 211, 212, 5, 6, 0, 0, 212, 217, 1, 0, 0, 0, 213, 217, 3, 36, 18, 0, 214, 217, 3, 28, 14, 0, 215, 217, 5, 22, 0, 0, 216, 204, 1, 0, 0, 0, 216, 208, 1, 0, 0, 0, 216, 209, 1, 0, 0, 0, 216, 213, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 215, 1, 0, 0, 0, 217, 224, 1, 0, 0, 0, 218, 219, 10, 7, 0, 0, 219, 220, 3, 32, 16, 0, 220, 221, 3, 30, 15, 8, 221, 223, 1, 0, 0, 0, 222, 218, 1, 0, 0, 0, 223, 226, 1, 0, 0, 0, 224, 222, 1, 0, 0, 0, 224, 225, 1, 0, 0, 0, 225, 31, 1, 0, 0, 0, 226, 224, 1, 0, 0, 0, 227, 228, 7, 2, 0, 0, 228, 33, 1, 0, 0, 0, 229, 230, 7, 3, 0, 0, 230, 35, 1, 0, 0, 0, 231, 232, 5, 23, 0, 0, 232, 234, 5, 19, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 240, 1, 0, 0, 0, 235, 236, 3, 40, 20, 0, 236, 237, 5, 19, 0, 0, 237, 239, 1, 0, 0, 0, 238, 235, 1, 0, 0, 0, 239, 242, 1, 0, 0, 0, 240, 238, 1, 0, 0, 0, 240, 241, 1, 0, 0, 0, 241, 243, 1, 0, 0, 0, 242, 240, 1, 0, 0, 0, 243, 244, 3, 48, 24, 0, 244, 37, 1, 0, 0, 0, 245, 246, 5, 23, 0, 0, 246, 248, 5, 19, 0, 0, 247, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 254, 1, 0, 0, 0, 249, 250, 3, 40, 20, 0, 250, 251, 5, 19, 0, 0, 251, 253, 1, 0, 0, 0, 252, 249, 1, 0, 0, 0, 253, 256, 1, 0, 0, 0, 254, 252, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 257, 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 257, 258, 3, 42, 21, 0, 258, 39, 1, 0, 0, 0, 259, 262, 3, 42, 21, 0, 260, 262, 3, 48, 24, 0, 261, 259, 1, 0, 0, 0, 261, 260, 1, 0, 0, 0, 262, 41, 1, 0, 0, 0, 263, 264, 3, 48, 24, 0, 264, 266, 5, 5, 0, 0, 265, 267, 3, 44, 22, 0, 266, 265, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 269, 5, 6, 0, 0, 269, 43, 1, 0, 0, 0, 270, 275, 3, 30, 15, 0, 271, 272, 5, 10, 0, 0, 272, 274, 3, 30, 15, 0, 273, 271, 1, 0, 0, 0, 274, 277, 1, 0, 0, 0, 275, 273, 1, 0, 0, 0, 275, 276, 1, 0, 0, 0, 276, 45, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 278, 279, 7, 4, 0, 0, 279, 47, 1, 0, 0, 0, 280, 281, 5, 46, 0, 0, 281, 49, 1, 0, 0, 0, 25, 53, 56, 65, 67, 84, 89, 95, 110, 115, 125, 134, 136, 148, 191, 198, 202, 216, 224, 233, 240, 247, 254, 261, 266, 275] \ No newline at end of file diff --git a/src/main/java/de/maishai/antlr/Decaf.tokens b/src/main/java/de/maishai/antlr/Decaf.tokens index 2f81403..78b9736 100644 --- a/src/main/java/de/maishai/antlr/Decaf.tokens +++ b/src/main/java/de/maishai/antlr/Decaf.tokens @@ -17,46 +17,75 @@ T__15=16 T__16=17 T__17=18 T__18=19 -T__19=20 -T__20=21 -PUBLIC=22 -NEW=23 +PUBLIC=20 +NEW=21 +NULL=22 +THIS=23 SUB=24 ADD=25 MUL=26 -INT=27 -BOOL=28 -VOID=29 -CHAR=30 -IDENTIFIER=31 -NUMBER=32 -WS=33 +GT=27 +LT=28 +GE=29 +LE=30 +EQ=31 +NE=32 +AND=33 +OR=34 +ASSIGN=35 +ADD_ASSIGN=36 +SUB_ASSIGN=37 +MUL_ASSIGN=38 +NOT=39 +INT=40 +BOOL=41 +VOID=42 +CHAR=43 +BOOLEANLITERAL=44 +CHARLITERAL=45 +IDENTIFIER=46 +NUMBER=47 +WS=48 'class'=1 '{'=2 '}'=3 ';'=4 -'='=5 -'('=6 -')'=7 -'static'=8 -'main'=9 -'String[] args'=10 -','=11 -'if'=12 -'else'=13 -'for'=14 -'while'=15 -'do'=16 -'return'=17 -'break'=18 -'continue'=19 -'true'=20 -'false'=21 -'public'=22 -'new'=23 +'('=5 +')'=6 +'static'=7 +'main'=8 +'String[] args'=9 +','=10 +'if'=11 +'else'=12 +'for'=13 +'while'=14 +'do'=15 +'return'=16 +'break'=17 +'continue'=18 +'.'=19 +'public'=20 +'new'=21 +'null'=22 +'this'=23 '-'=24 '+'=25 '*'=26 -'int'=27 -'boolean'=28 -'void'=29 +'>'=27 +'<'=28 +'>='=29 +'<='=30 +'=='=31 +'!='=32 +'&&'=33 +'||'=34 +'='=35 +'+='=36 +'-='=37 +'*='=38 +'!'=39 +'int'=40 +'boolean'=41 +'void'=42 +'char'=43 diff --git a/src/main/java/de/maishai/antlr/DecafBaseListener.java b/src/main/java/de/maishai/antlr/DecafBaseListener.java index 739b886..2e2ade1 100644 --- a/src/main/java/de/maishai/antlr/DecafBaseListener.java +++ b/src/main/java/de/maishai/antlr/DecafBaseListener.java @@ -41,13 +41,37 @@ public class DecafBaseListener implements DecafListener { * *

The default implementation does nothing.

*/ - @Override public void enterVar(DecafParser.VarContext ctx) { } + @Override public void enterField(DecafParser.FieldContext ctx) { } /** * {@inheritDoc} * *

The default implementation does nothing.

*/ - @Override public void exitVar(DecafParser.VarContext ctx) { } + @Override public void exitField(DecafParser.FieldContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLocalVar(DecafParser.LocalVarContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLocalVar(DecafParser.LocalVarContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssignSign(DecafParser.AssignSignContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssignSign(DecafParser.AssignSignContext ctx) { } /** * {@inheritDoc} * @@ -96,6 +120,18 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitMainmeth(DecafParser.MainmethContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstructor(DecafParser.ConstructorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstructor(DecafParser.ConstructorContext ctx) { } /** * {@inheritDoc} * @@ -228,6 +264,18 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitContinue(DecafParser.ContinueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssignment(DecafParser.AssignmentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssignment(DecafParser.AssignmentContext ctx) { } /** * {@inheritDoc} * @@ -240,18 +288,6 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssign(DecafParser.AssignContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssign(DecafParser.AssignContext ctx) { } /** * {@inheritDoc} * @@ -276,6 +312,30 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitNew(DecafParser.NewContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNull(DecafParser.NullContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNull(DecafParser.NullContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterUnaryOperation(DecafParser.UnaryOperationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitUnaryOperation(DecafParser.UnaryOperationContext ctx) { } /** * {@inheritDoc} * @@ -288,18 +348,6 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitIdentifier(DecafParser.IdentifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { } /** * {@inheritDoc} * @@ -360,6 +408,30 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitBinaryOp(DecafParser.BinaryOpContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterUnaryOp(DecafParser.UnaryOpContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitUnaryOp(DecafParser.UnaryOpContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFieldId(DecafParser.FieldIdContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFieldId(DecafParser.FieldIdContext ctx) { } /** * {@inheritDoc} * @@ -372,6 +444,30 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitMethCall(DecafParser.MethCallContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecipient(DecafParser.RecipientContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecipient(DecafParser.RecipientContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethName(DecafParser.MethNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethName(DecafParser.MethNameContext ctx) { } /** * {@inheritDoc} * @@ -396,18 +492,6 @@ public class DecafBaseListener implements DecafListener { *

The default implementation does nothing.

*/ @Override public void exitLiteral(DecafParser.LiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBoolean(DecafParser.BooleanContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBoolean(DecafParser.BooleanContext ctx) { } /** * {@inheritDoc} * diff --git a/src/main/java/de/maishai/antlr/DecafBaseVisitor.java b/src/main/java/de/maishai/antlr/DecafBaseVisitor.java index ca4ed96..5fc8514 100644 --- a/src/main/java/de/maishai/antlr/DecafBaseVisitor.java +++ b/src/main/java/de/maishai/antlr/DecafBaseVisitor.java @@ -32,7 +32,21 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements *

The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.

*/ - @Override public T visitVar(DecafParser.VarContext ctx) { return visitChildren(ctx); } + @Override public T visitField(DecafParser.FieldContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitLocalVar(DecafParser.LocalVarContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAssignSign(DecafParser.AssignSignContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -61,6 +75,13 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitMainmeth(DecafParser.MainmethContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitConstructor(DecafParser.ConstructorContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -144,14 +165,14 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements *

The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.

*/ - @Override public T visitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { return visitChildren(ctx); } + @Override public T visitAssignment(DecafParser.AssignmentContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * *

The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.

*/ - @Override public T visitAssign(DecafParser.AssignContext ctx) { return visitChildren(ctx); } + @Override public T visitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -172,14 +193,21 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements *

The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.

*/ - @Override public T visitIdentifier(DecafParser.IdentifierContext ctx) { return visitChildren(ctx); } + @Override public T visitNull(DecafParser.NullContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * *

The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.

*/ - @Override public T visitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { return visitChildren(ctx); } + @Override public T visitUnaryOperation(DecafParser.UnaryOperationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIdentifier(DecafParser.IdentifierContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -215,6 +243,20 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitBinaryOp(DecafParser.BinaryOpContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitUnaryOp(DecafParser.UnaryOpContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFieldId(DecafParser.FieldIdContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -222,6 +264,20 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitMethCall(DecafParser.MethCallContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRecipient(DecafParser.RecipientContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitMethName(DecafParser.MethNameContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -236,13 +292,6 @@ public class DecafBaseVisitor extends AbstractParseTreeVisitor implements * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitLiteral(DecafParser.LiteralContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitBoolean(DecafParser.BooleanContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * diff --git a/src/main/java/de/maishai/antlr/DecafLexer.interp b/src/main/java/de/maishai/antlr/DecafLexer.interp index 8a2ad20..3ad479c 100644 --- a/src/main/java/de/maishai/antlr/DecafLexer.interp +++ b/src/main/java/de/maishai/antlr/DecafLexer.interp @@ -4,7 +4,6 @@ null '{' '}' ';' -'=' '(' ')' 'static' @@ -19,16 +18,32 @@ null 'return' 'break' 'continue' -'true' -'false' +'.' 'public' 'new' +'null' +'this' '-' '+' '*' +'>' +'<' +'>=' +'<=' +'==' +'!=' +'&&' +'||' +'=' +'+=' +'-=' +'*=' +'!' 'int' 'boolean' 'void' +'char' +null null null null @@ -55,17 +70,32 @@ null null null null -null -null PUBLIC NEW +NULL +THIS SUB ADD MUL +GT +LT +GE +LE +EQ +NE +AND +OR +ASSIGN +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +NOT INT BOOL VOID CHAR +BOOLEANLITERAL +CHARLITERAL IDENTIFIER NUMBER WS @@ -90,17 +120,32 @@ T__15 T__16 T__17 T__18 -T__19 -T__20 PUBLIC NEW +NULL +THIS SUB ADD MUL +GT +LT +GE +LE +EQ +NE +AND +OR +ASSIGN +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +NOT INT BOOL VOID CHAR +BOOLEANLITERAL +CHARLITERAL IDENTIFIER NUMBER WS @@ -113,4 +158,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 33, 219, 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, 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, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 4, 30, 207, 8, 30, 11, 30, 12, 30, 208, 1, 31, 4, 31, 212, 8, 31, 11, 31, 12, 31, 213, 1, 32, 1, 32, 1, 32, 1, 32, 0, 0, 33, 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, 1, 0, 4, 1, 0, 39, 39, 2, 0, 65, 90, 97, 122, 1, 0, 48, 57, 3, 0, 9, 10, 13, 13, 32, 32, 220, 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, 1, 67, 1, 0, 0, 0, 3, 73, 1, 0, 0, 0, 5, 75, 1, 0, 0, 0, 7, 77, 1, 0, 0, 0, 9, 79, 1, 0, 0, 0, 11, 81, 1, 0, 0, 0, 13, 83, 1, 0, 0, 0, 15, 85, 1, 0, 0, 0, 17, 92, 1, 0, 0, 0, 19, 97, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 116, 1, 0, 0, 0, 27, 121, 1, 0, 0, 0, 29, 125, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 134, 1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 156, 1, 0, 0, 0, 41, 161, 1, 0, 0, 0, 43, 167, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 178, 1, 0, 0, 0, 49, 180, 1, 0, 0, 0, 51, 182, 1, 0, 0, 0, 53, 184, 1, 0, 0, 0, 55, 188, 1, 0, 0, 0, 57, 196, 1, 0, 0, 0, 59, 201, 1, 0, 0, 0, 61, 206, 1, 0, 0, 0, 63, 211, 1, 0, 0, 0, 65, 215, 1, 0, 0, 0, 67, 68, 5, 99, 0, 0, 68, 69, 5, 108, 0, 0, 69, 70, 5, 97, 0, 0, 70, 71, 5, 115, 0, 0, 71, 72, 5, 115, 0, 0, 72, 2, 1, 0, 0, 0, 73, 74, 5, 123, 0, 0, 74, 4, 1, 0, 0, 0, 75, 76, 5, 125, 0, 0, 76, 6, 1, 0, 0, 0, 77, 78, 5, 59, 0, 0, 78, 8, 1, 0, 0, 0, 79, 80, 5, 61, 0, 0, 80, 10, 1, 0, 0, 0, 81, 82, 5, 40, 0, 0, 82, 12, 1, 0, 0, 0, 83, 84, 5, 41, 0, 0, 84, 14, 1, 0, 0, 0, 85, 86, 5, 115, 0, 0, 86, 87, 5, 116, 0, 0, 87, 88, 5, 97, 0, 0, 88, 89, 5, 116, 0, 0, 89, 90, 5, 105, 0, 0, 90, 91, 5, 99, 0, 0, 91, 16, 1, 0, 0, 0, 92, 93, 5, 109, 0, 0, 93, 94, 5, 97, 0, 0, 94, 95, 5, 105, 0, 0, 95, 96, 5, 110, 0, 0, 96, 18, 1, 0, 0, 0, 97, 98, 5, 83, 0, 0, 98, 99, 5, 116, 0, 0, 99, 100, 5, 114, 0, 0, 100, 101, 5, 105, 0, 0, 101, 102, 5, 110, 0, 0, 102, 103, 5, 103, 0, 0, 103, 104, 5, 91, 0, 0, 104, 105, 5, 93, 0, 0, 105, 106, 5, 32, 0, 0, 106, 107, 5, 97, 0, 0, 107, 108, 5, 114, 0, 0, 108, 109, 5, 103, 0, 0, 109, 110, 5, 115, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 44, 0, 0, 112, 22, 1, 0, 0, 0, 113, 114, 5, 105, 0, 0, 114, 115, 5, 102, 0, 0, 115, 24, 1, 0, 0, 0, 116, 117, 5, 101, 0, 0, 117, 118, 5, 108, 0, 0, 118, 119, 5, 115, 0, 0, 119, 120, 5, 101, 0, 0, 120, 26, 1, 0, 0, 0, 121, 122, 5, 102, 0, 0, 122, 123, 5, 111, 0, 0, 123, 124, 5, 114, 0, 0, 124, 28, 1, 0, 0, 0, 125, 126, 5, 119, 0, 0, 126, 127, 5, 104, 0, 0, 127, 128, 5, 105, 0, 0, 128, 129, 5, 108, 0, 0, 129, 130, 5, 101, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 100, 0, 0, 132, 133, 5, 111, 0, 0, 133, 32, 1, 0, 0, 0, 134, 135, 5, 114, 0, 0, 135, 136, 5, 101, 0, 0, 136, 137, 5, 116, 0, 0, 137, 138, 5, 117, 0, 0, 138, 139, 5, 114, 0, 0, 139, 140, 5, 110, 0, 0, 140, 34, 1, 0, 0, 0, 141, 142, 5, 98, 0, 0, 142, 143, 5, 114, 0, 0, 143, 144, 5, 101, 0, 0, 144, 145, 5, 97, 0, 0, 145, 146, 5, 107, 0, 0, 146, 36, 1, 0, 0, 0, 147, 148, 5, 99, 0, 0, 148, 149, 5, 111, 0, 0, 149, 150, 5, 110, 0, 0, 150, 151, 5, 116, 0, 0, 151, 152, 5, 105, 0, 0, 152, 153, 5, 110, 0, 0, 153, 154, 5, 117, 0, 0, 154, 155, 5, 101, 0, 0, 155, 38, 1, 0, 0, 0, 156, 157, 5, 116, 0, 0, 157, 158, 5, 114, 0, 0, 158, 159, 5, 117, 0, 0, 159, 160, 5, 101, 0, 0, 160, 40, 1, 0, 0, 0, 161, 162, 5, 102, 0, 0, 162, 163, 5, 97, 0, 0, 163, 164, 5, 108, 0, 0, 164, 165, 5, 115, 0, 0, 165, 166, 5, 101, 0, 0, 166, 42, 1, 0, 0, 0, 167, 168, 5, 112, 0, 0, 168, 169, 5, 117, 0, 0, 169, 170, 5, 98, 0, 0, 170, 171, 5, 108, 0, 0, 171, 172, 5, 105, 0, 0, 172, 173, 5, 99, 0, 0, 173, 44, 1, 0, 0, 0, 174, 175, 5, 110, 0, 0, 175, 176, 5, 101, 0, 0, 176, 177, 5, 119, 0, 0, 177, 46, 1, 0, 0, 0, 178, 179, 5, 45, 0, 0, 179, 48, 1, 0, 0, 0, 180, 181, 5, 43, 0, 0, 181, 50, 1, 0, 0, 0, 182, 183, 5, 42, 0, 0, 183, 52, 1, 0, 0, 0, 184, 185, 5, 105, 0, 0, 185, 186, 5, 110, 0, 0, 186, 187, 5, 116, 0, 0, 187, 54, 1, 0, 0, 0, 188, 189, 5, 98, 0, 0, 189, 190, 5, 111, 0, 0, 190, 191, 5, 111, 0, 0, 191, 192, 5, 108, 0, 0, 192, 193, 5, 101, 0, 0, 193, 194, 5, 97, 0, 0, 194, 195, 5, 110, 0, 0, 195, 56, 1, 0, 0, 0, 196, 197, 5, 118, 0, 0, 197, 198, 5, 111, 0, 0, 198, 199, 5, 105, 0, 0, 199, 200, 5, 100, 0, 0, 200, 58, 1, 0, 0, 0, 201, 202, 7, 0, 0, 0, 202, 203, 7, 1, 0, 0, 203, 204, 7, 0, 0, 0, 204, 60, 1, 0, 0, 0, 205, 207, 7, 1, 0, 0, 206, 205, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 62, 1, 0, 0, 0, 210, 212, 7, 2, 0, 0, 211, 210, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 213, 214, 1, 0, 0, 0, 214, 64, 1, 0, 0, 0, 215, 216, 7, 3, 0, 0, 216, 217, 1, 0, 0, 0, 217, 218, 6, 32, 0, 0, 218, 66, 1, 0, 0, 0, 3, 0, 208, 213, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 48, 299, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 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, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 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, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 3, 43, 280, 8, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 4, 45, 287, 8, 45, 11, 45, 12, 45, 288, 1, 46, 4, 46, 292, 8, 46, 11, 46, 12, 46, 293, 1, 47, 1, 47, 1, 47, 1, 47, 0, 0, 48, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 1, 0, 4, 1, 0, 39, 39, 2, 0, 65, 90, 97, 122, 1, 0, 48, 57, 3, 0, 9, 10, 13, 13, 32, 32, 301, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 1, 97, 1, 0, 0, 0, 3, 103, 1, 0, 0, 0, 5, 105, 1, 0, 0, 0, 7, 107, 1, 0, 0, 0, 9, 109, 1, 0, 0, 0, 11, 111, 1, 0, 0, 0, 13, 113, 1, 0, 0, 0, 15, 120, 1, 0, 0, 0, 17, 125, 1, 0, 0, 0, 19, 139, 1, 0, 0, 0, 21, 141, 1, 0, 0, 0, 23, 144, 1, 0, 0, 0, 25, 149, 1, 0, 0, 0, 27, 153, 1, 0, 0, 0, 29, 159, 1, 0, 0, 0, 31, 162, 1, 0, 0, 0, 33, 169, 1, 0, 0, 0, 35, 175, 1, 0, 0, 0, 37, 184, 1, 0, 0, 0, 39, 186, 1, 0, 0, 0, 41, 193, 1, 0, 0, 0, 43, 197, 1, 0, 0, 0, 45, 202, 1, 0, 0, 0, 47, 207, 1, 0, 0, 0, 49, 209, 1, 0, 0, 0, 51, 211, 1, 0, 0, 0, 53, 213, 1, 0, 0, 0, 55, 215, 1, 0, 0, 0, 57, 217, 1, 0, 0, 0, 59, 220, 1, 0, 0, 0, 61, 223, 1, 0, 0, 0, 63, 226, 1, 0, 0, 0, 65, 229, 1, 0, 0, 0, 67, 232, 1, 0, 0, 0, 69, 235, 1, 0, 0, 0, 71, 237, 1, 0, 0, 0, 73, 240, 1, 0, 0, 0, 75, 243, 1, 0, 0, 0, 77, 246, 1, 0, 0, 0, 79, 248, 1, 0, 0, 0, 81, 252, 1, 0, 0, 0, 83, 260, 1, 0, 0, 0, 85, 265, 1, 0, 0, 0, 87, 279, 1, 0, 0, 0, 89, 281, 1, 0, 0, 0, 91, 286, 1, 0, 0, 0, 93, 291, 1, 0, 0, 0, 95, 295, 1, 0, 0, 0, 97, 98, 5, 99, 0, 0, 98, 99, 5, 108, 0, 0, 99, 100, 5, 97, 0, 0, 100, 101, 5, 115, 0, 0, 101, 102, 5, 115, 0, 0, 102, 2, 1, 0, 0, 0, 103, 104, 5, 123, 0, 0, 104, 4, 1, 0, 0, 0, 105, 106, 5, 125, 0, 0, 106, 6, 1, 0, 0, 0, 107, 108, 5, 59, 0, 0, 108, 8, 1, 0, 0, 0, 109, 110, 5, 40, 0, 0, 110, 10, 1, 0, 0, 0, 111, 112, 5, 41, 0, 0, 112, 12, 1, 0, 0, 0, 113, 114, 5, 115, 0, 0, 114, 115, 5, 116, 0, 0, 115, 116, 5, 97, 0, 0, 116, 117, 5, 116, 0, 0, 117, 118, 5, 105, 0, 0, 118, 119, 5, 99, 0, 0, 119, 14, 1, 0, 0, 0, 120, 121, 5, 109, 0, 0, 121, 122, 5, 97, 0, 0, 122, 123, 5, 105, 0, 0, 123, 124, 5, 110, 0, 0, 124, 16, 1, 0, 0, 0, 125, 126, 5, 83, 0, 0, 126, 127, 5, 116, 0, 0, 127, 128, 5, 114, 0, 0, 128, 129, 5, 105, 0, 0, 129, 130, 5, 110, 0, 0, 130, 131, 5, 103, 0, 0, 131, 132, 5, 91, 0, 0, 132, 133, 5, 93, 0, 0, 133, 134, 5, 32, 0, 0, 134, 135, 5, 97, 0, 0, 135, 136, 5, 114, 0, 0, 136, 137, 5, 103, 0, 0, 137, 138, 5, 115, 0, 0, 138, 18, 1, 0, 0, 0, 139, 140, 5, 44, 0, 0, 140, 20, 1, 0, 0, 0, 141, 142, 5, 105, 0, 0, 142, 143, 5, 102, 0, 0, 143, 22, 1, 0, 0, 0, 144, 145, 5, 101, 0, 0, 145, 146, 5, 108, 0, 0, 146, 147, 5, 115, 0, 0, 147, 148, 5, 101, 0, 0, 148, 24, 1, 0, 0, 0, 149, 150, 5, 102, 0, 0, 150, 151, 5, 111, 0, 0, 151, 152, 5, 114, 0, 0, 152, 26, 1, 0, 0, 0, 153, 154, 5, 119, 0, 0, 154, 155, 5, 104, 0, 0, 155, 156, 5, 105, 0, 0, 156, 157, 5, 108, 0, 0, 157, 158, 5, 101, 0, 0, 158, 28, 1, 0, 0, 0, 159, 160, 5, 100, 0, 0, 160, 161, 5, 111, 0, 0, 161, 30, 1, 0, 0, 0, 162, 163, 5, 114, 0, 0, 163, 164, 5, 101, 0, 0, 164, 165, 5, 116, 0, 0, 165, 166, 5, 117, 0, 0, 166, 167, 5, 114, 0, 0, 167, 168, 5, 110, 0, 0, 168, 32, 1, 0, 0, 0, 169, 170, 5, 98, 0, 0, 170, 171, 5, 114, 0, 0, 171, 172, 5, 101, 0, 0, 172, 173, 5, 97, 0, 0, 173, 174, 5, 107, 0, 0, 174, 34, 1, 0, 0, 0, 175, 176, 5, 99, 0, 0, 176, 177, 5, 111, 0, 0, 177, 178, 5, 110, 0, 0, 178, 179, 5, 116, 0, 0, 179, 180, 5, 105, 0, 0, 180, 181, 5, 110, 0, 0, 181, 182, 5, 117, 0, 0, 182, 183, 5, 101, 0, 0, 183, 36, 1, 0, 0, 0, 184, 185, 5, 46, 0, 0, 185, 38, 1, 0, 0, 0, 186, 187, 5, 112, 0, 0, 187, 188, 5, 117, 0, 0, 188, 189, 5, 98, 0, 0, 189, 190, 5, 108, 0, 0, 190, 191, 5, 105, 0, 0, 191, 192, 5, 99, 0, 0, 192, 40, 1, 0, 0, 0, 193, 194, 5, 110, 0, 0, 194, 195, 5, 101, 0, 0, 195, 196, 5, 119, 0, 0, 196, 42, 1, 0, 0, 0, 197, 198, 5, 110, 0, 0, 198, 199, 5, 117, 0, 0, 199, 200, 5, 108, 0, 0, 200, 201, 5, 108, 0, 0, 201, 44, 1, 0, 0, 0, 202, 203, 5, 116, 0, 0, 203, 204, 5, 104, 0, 0, 204, 205, 5, 105, 0, 0, 205, 206, 5, 115, 0, 0, 206, 46, 1, 0, 0, 0, 207, 208, 5, 45, 0, 0, 208, 48, 1, 0, 0, 0, 209, 210, 5, 43, 0, 0, 210, 50, 1, 0, 0, 0, 211, 212, 5, 42, 0, 0, 212, 52, 1, 0, 0, 0, 213, 214, 5, 62, 0, 0, 214, 54, 1, 0, 0, 0, 215, 216, 5, 60, 0, 0, 216, 56, 1, 0, 0, 0, 217, 218, 5, 62, 0, 0, 218, 219, 5, 61, 0, 0, 219, 58, 1, 0, 0, 0, 220, 221, 5, 60, 0, 0, 221, 222, 5, 61, 0, 0, 222, 60, 1, 0, 0, 0, 223, 224, 5, 61, 0, 0, 224, 225, 5, 61, 0, 0, 225, 62, 1, 0, 0, 0, 226, 227, 5, 33, 0, 0, 227, 228, 5, 61, 0, 0, 228, 64, 1, 0, 0, 0, 229, 230, 5, 38, 0, 0, 230, 231, 5, 38, 0, 0, 231, 66, 1, 0, 0, 0, 232, 233, 5, 124, 0, 0, 233, 234, 5, 124, 0, 0, 234, 68, 1, 0, 0, 0, 235, 236, 5, 61, 0, 0, 236, 70, 1, 0, 0, 0, 237, 238, 5, 43, 0, 0, 238, 239, 5, 61, 0, 0, 239, 72, 1, 0, 0, 0, 240, 241, 5, 45, 0, 0, 241, 242, 5, 61, 0, 0, 242, 74, 1, 0, 0, 0, 243, 244, 5, 42, 0, 0, 244, 245, 5, 61, 0, 0, 245, 76, 1, 0, 0, 0, 246, 247, 5, 33, 0, 0, 247, 78, 1, 0, 0, 0, 248, 249, 5, 105, 0, 0, 249, 250, 5, 110, 0, 0, 250, 251, 5, 116, 0, 0, 251, 80, 1, 0, 0, 0, 252, 253, 5, 98, 0, 0, 253, 254, 5, 111, 0, 0, 254, 255, 5, 111, 0, 0, 255, 256, 5, 108, 0, 0, 256, 257, 5, 101, 0, 0, 257, 258, 5, 97, 0, 0, 258, 259, 5, 110, 0, 0, 259, 82, 1, 0, 0, 0, 260, 261, 5, 118, 0, 0, 261, 262, 5, 111, 0, 0, 262, 263, 5, 105, 0, 0, 263, 264, 5, 100, 0, 0, 264, 84, 1, 0, 0, 0, 265, 266, 5, 99, 0, 0, 266, 267, 5, 104, 0, 0, 267, 268, 5, 97, 0, 0, 268, 269, 5, 114, 0, 0, 269, 86, 1, 0, 0, 0, 270, 271, 5, 116, 0, 0, 271, 272, 5, 114, 0, 0, 272, 273, 5, 117, 0, 0, 273, 280, 5, 101, 0, 0, 274, 275, 5, 102, 0, 0, 275, 276, 5, 97, 0, 0, 276, 277, 5, 108, 0, 0, 277, 278, 5, 115, 0, 0, 278, 280, 5, 101, 0, 0, 279, 270, 1, 0, 0, 0, 279, 274, 1, 0, 0, 0, 280, 88, 1, 0, 0, 0, 281, 282, 7, 0, 0, 0, 282, 283, 7, 1, 0, 0, 283, 284, 7, 0, 0, 0, 284, 90, 1, 0, 0, 0, 285, 287, 7, 1, 0, 0, 286, 285, 1, 0, 0, 0, 287, 288, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 92, 1, 0, 0, 0, 290, 292, 7, 2, 0, 0, 291, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 294, 1, 0, 0, 0, 294, 94, 1, 0, 0, 0, 295, 296, 7, 3, 0, 0, 296, 297, 1, 0, 0, 0, 297, 298, 6, 47, 0, 0, 298, 96, 1, 0, 0, 0, 4, 0, 279, 288, 293, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/main/java/de/maishai/antlr/DecafLexer.java b/src/main/java/de/maishai/antlr/DecafLexer.java index 05dfaa1..7145a24 100644 --- a/src/main/java/de/maishai/antlr/DecafLexer.java +++ b/src/main/java/de/maishai/antlr/DecafLexer.java @@ -19,8 +19,11 @@ public class DecafLexer extends Lexer { public static final int 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, PUBLIC=22, NEW=23, SUB=24, ADD=25, - MUL=26, INT=27, BOOL=28, VOID=29, CHAR=30, IDENTIFIER=31, NUMBER=32, WS=33; + T__17=18, T__18=19, PUBLIC=20, NEW=21, NULL=22, THIS=23, SUB=24, ADD=25, + MUL=26, GT=27, LT=28, GE=29, LE=30, EQ=31, NE=32, AND=33, OR=34, ASSIGN=35, + ADD_ASSIGN=36, SUB_ASSIGN=37, MUL_ASSIGN=38, NOT=39, INT=40, BOOL=41, + VOID=42, CHAR=43, BOOLEANLITERAL=44, CHARLITERAL=45, IDENTIFIER=46, NUMBER=47, + WS=48; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -33,26 +36,32 @@ public class DecafLexer extends Lexer { return new String[] { "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", "PUBLIC", "NEW", "SUB", "ADD", "MUL", - "INT", "BOOL", "VOID", "CHAR", "IDENTIFIER", "NUMBER", "WS" + "T__17", "T__18", "PUBLIC", "NEW", "NULL", "THIS", "SUB", "ADD", "MUL", + "GT", "LT", "GE", "LE", "EQ", "NE", "AND", "OR", "ASSIGN", "ADD_ASSIGN", + "SUB_ASSIGN", "MUL_ASSIGN", "NOT", "INT", "BOOL", "VOID", "CHAR", "BOOLEANLITERAL", + "CHARLITERAL", "IDENTIFIER", "NUMBER", "WS" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, "'class'", "'{'", "'}'", "';'", "'='", "'('", "')'", "'static'", - "'main'", "'String[] args'", "','", "'if'", "'else'", "'for'", "'while'", - "'do'", "'return'", "'break'", "'continue'", "'true'", "'false'", "'public'", - "'new'", "'-'", "'+'", "'*'", "'int'", "'boolean'", "'void'" + null, "'class'", "'{'", "'}'", "';'", "'('", "')'", "'static'", "'main'", + "'String[] args'", "','", "'if'", "'else'", "'for'", "'while'", "'do'", + "'return'", "'break'", "'continue'", "'.'", "'public'", "'new'", "'null'", + "'this'", "'-'", "'+'", "'*'", "'>'", "'<'", "'>='", "'<='", "'=='", + "'!='", "'&&'", "'||'", "'='", "'+='", "'-='", "'*='", "'!'", "'int'", + "'boolean'", "'void'", "'char'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, "PUBLIC", - "NEW", "SUB", "ADD", "MUL", "INT", "BOOL", "VOID", "CHAR", "IDENTIFIER", + null, null, null, null, null, null, null, null, "PUBLIC", "NEW", "NULL", + "THIS", "SUB", "ADD", "MUL", "GT", "LT", "GE", "LE", "EQ", "NE", "AND", + "OR", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "NOT", "INT", + "BOOL", "VOID", "CHAR", "BOOLEANLITERAL", "CHARLITERAL", "IDENTIFIER", "NUMBER", "WS" }; } @@ -115,7 +124,7 @@ public class DecafLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\u0004\u0000!\u00db\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ + "\u0004\u00000\u012b\u0006\uffff\uffff\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"+ @@ -125,127 +134,173 @@ public class DecafLexer extends Lexer { "\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 \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\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001"+ - "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001"+ - "\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001"+ - "\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001"+ - "\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f"+ - "\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001"+ - "\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001"+ + "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+ + "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+ + "&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\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\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006"+ + "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+ + "\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001\b\u0001"+ + "\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001"+ + "\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+ + "\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r"+ + "\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001"+ + "\u000e\u0001\u000f\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"+ - "\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001"+ - "\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001"+ - "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"+ - "\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001"+ - "\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001"+ + "\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001"+ + "\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+ + "\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001"+ + "\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001"+ "\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001"+ "\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001"+ - "\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ - "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001"+ - "\u001c\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001"+ - "\u001d\u0001\u001e\u0004\u001e\u00cf\b\u001e\u000b\u001e\f\u001e\u00d0"+ - "\u0001\u001f\u0004\u001f\u00d4\b\u001f\u000b\u001f\f\u001f\u00d5\u0001"+ - " \u0001 \u0001 \u0001 \u0000\u0000!\u0001\u0001\u0003\u0002\u0005\u0003"+ + "\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001d\u0001"+ + "\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001f\u0001"+ + "\u001f\u0001\u001f\u0001 \u0001 \u0001 \u0001!\u0001!\u0001!\u0001\"\u0001"+ + "\"\u0001#\u0001#\u0001#\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001"+ + "&\u0001&\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001(\u0001"+ + "(\u0001(\u0001(\u0001(\u0001)\u0001)\u0001)\u0001)\u0001)\u0001*\u0001"+ + "*\u0001*\u0001*\u0001*\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001"+ + "+\u0001+\u0001+\u0003+\u0118\b+\u0001,\u0001,\u0001,\u0001,\u0001-\u0004"+ + "-\u011f\b-\u000b-\f-\u0120\u0001.\u0004.\u0124\b.\u000b.\f.\u0125\u0001"+ + "/\u0001/\u0001/\u0001/\u0000\u00000\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\u001c"+ - "9\u001d;\u001e=\u001f? A!\u0001\u0000\u0004\u0001\u0000\'\'\u0002\u0000"+ - "AZaz\u0001\u000009\u0003\u0000\t\n\r\r \u00dc\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\u0000"+ - "1\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\u0001C\u0001"+ - "\u0000\u0000\u0000\u0003I\u0001\u0000\u0000\u0000\u0005K\u0001\u0000\u0000"+ - "\u0000\u0007M\u0001\u0000\u0000\u0000\tO\u0001\u0000\u0000\u0000\u000b"+ - "Q\u0001\u0000\u0000\u0000\rS\u0001\u0000\u0000\u0000\u000fU\u0001\u0000"+ - "\u0000\u0000\u0011\\\u0001\u0000\u0000\u0000\u0013a\u0001\u0000\u0000"+ - "\u0000\u0015o\u0001\u0000\u0000\u0000\u0017q\u0001\u0000\u0000\u0000\u0019"+ - "t\u0001\u0000\u0000\u0000\u001by\u0001\u0000\u0000\u0000\u001d}\u0001"+ - "\u0000\u0000\u0000\u001f\u0083\u0001\u0000\u0000\u0000!\u0086\u0001\u0000"+ - "\u0000\u0000#\u008d\u0001\u0000\u0000\u0000%\u0093\u0001\u0000\u0000\u0000"+ - "\'\u009c\u0001\u0000\u0000\u0000)\u00a1\u0001\u0000\u0000\u0000+\u00a7"+ - "\u0001\u0000\u0000\u0000-\u00ae\u0001\u0000\u0000\u0000/\u00b2\u0001\u0000"+ - "\u0000\u00001\u00b4\u0001\u0000\u0000\u00003\u00b6\u0001\u0000\u0000\u0000"+ - "5\u00b8\u0001\u0000\u0000\u00007\u00bc\u0001\u0000\u0000\u00009\u00c4"+ - "\u0001\u0000\u0000\u0000;\u00c9\u0001\u0000\u0000\u0000=\u00ce\u0001\u0000"+ - "\u0000\u0000?\u00d3\u0001\u0000\u0000\u0000A\u00d7\u0001\u0000\u0000\u0000"+ - "CD\u0005c\u0000\u0000DE\u0005l\u0000\u0000EF\u0005a\u0000\u0000FG\u0005"+ - "s\u0000\u0000GH\u0005s\u0000\u0000H\u0002\u0001\u0000\u0000\u0000IJ\u0005"+ - "{\u0000\u0000J\u0004\u0001\u0000\u0000\u0000KL\u0005}\u0000\u0000L\u0006"+ - "\u0001\u0000\u0000\u0000MN\u0005;\u0000\u0000N\b\u0001\u0000\u0000\u0000"+ - "OP\u0005=\u0000\u0000P\n\u0001\u0000\u0000\u0000QR\u0005(\u0000\u0000"+ - "R\f\u0001\u0000\u0000\u0000ST\u0005)\u0000\u0000T\u000e\u0001\u0000\u0000"+ - "\u0000UV\u0005s\u0000\u0000VW\u0005t\u0000\u0000WX\u0005a\u0000\u0000"+ - "XY\u0005t\u0000\u0000YZ\u0005i\u0000\u0000Z[\u0005c\u0000\u0000[\u0010"+ - "\u0001\u0000\u0000\u0000\\]\u0005m\u0000\u0000]^\u0005a\u0000\u0000^_"+ - "\u0005i\u0000\u0000_`\u0005n\u0000\u0000`\u0012\u0001\u0000\u0000\u0000"+ - "ab\u0005S\u0000\u0000bc\u0005t\u0000\u0000cd\u0005r\u0000\u0000de\u0005"+ - "i\u0000\u0000ef\u0005n\u0000\u0000fg\u0005g\u0000\u0000gh\u0005[\u0000"+ - "\u0000hi\u0005]\u0000\u0000ij\u0005 \u0000\u0000jk\u0005a\u0000\u0000"+ - "kl\u0005r\u0000\u0000lm\u0005g\u0000\u0000mn\u0005s\u0000\u0000n\u0014"+ - "\u0001\u0000\u0000\u0000op\u0005,\u0000\u0000p\u0016\u0001\u0000\u0000"+ - "\u0000qr\u0005i\u0000\u0000rs\u0005f\u0000\u0000s\u0018\u0001\u0000\u0000"+ - "\u0000tu\u0005e\u0000\u0000uv\u0005l\u0000\u0000vw\u0005s\u0000\u0000"+ - "wx\u0005e\u0000\u0000x\u001a\u0001\u0000\u0000\u0000yz\u0005f\u0000\u0000"+ - "z{\u0005o\u0000\u0000{|\u0005r\u0000\u0000|\u001c\u0001\u0000\u0000\u0000"+ - "}~\u0005w\u0000\u0000~\u007f\u0005h\u0000\u0000\u007f\u0080\u0005i\u0000"+ - "\u0000\u0080\u0081\u0005l\u0000\u0000\u0081\u0082\u0005e\u0000\u0000\u0082"+ - "\u001e\u0001\u0000\u0000\u0000\u0083\u0084\u0005d\u0000\u0000\u0084\u0085"+ - "\u0005o\u0000\u0000\u0085 \u0001\u0000\u0000\u0000\u0086\u0087\u0005r"+ - "\u0000\u0000\u0087\u0088\u0005e\u0000\u0000\u0088\u0089\u0005t\u0000\u0000"+ - "\u0089\u008a\u0005u\u0000\u0000\u008a\u008b\u0005r\u0000\u0000\u008b\u008c"+ - "\u0005n\u0000\u0000\u008c\"\u0001\u0000\u0000\u0000\u008d\u008e\u0005"+ - "b\u0000\u0000\u008e\u008f\u0005r\u0000\u0000\u008f\u0090\u0005e\u0000"+ - "\u0000\u0090\u0091\u0005a\u0000\u0000\u0091\u0092\u0005k\u0000\u0000\u0092"+ - "$\u0001\u0000\u0000\u0000\u0093\u0094\u0005c\u0000\u0000\u0094\u0095\u0005"+ - "o\u0000\u0000\u0095\u0096\u0005n\u0000\u0000\u0096\u0097\u0005t\u0000"+ - "\u0000\u0097\u0098\u0005i\u0000\u0000\u0098\u0099\u0005n\u0000\u0000\u0099"+ - "\u009a\u0005u\u0000\u0000\u009a\u009b\u0005e\u0000\u0000\u009b&\u0001"+ - "\u0000\u0000\u0000\u009c\u009d\u0005t\u0000\u0000\u009d\u009e\u0005r\u0000"+ - "\u0000\u009e\u009f\u0005u\u0000\u0000\u009f\u00a0\u0005e\u0000\u0000\u00a0"+ - "(\u0001\u0000\u0000\u0000\u00a1\u00a2\u0005f\u0000\u0000\u00a2\u00a3\u0005"+ - "a\u0000\u0000\u00a3\u00a4\u0005l\u0000\u0000\u00a4\u00a5\u0005s\u0000"+ - "\u0000\u00a5\u00a6\u0005e\u0000\u0000\u00a6*\u0001\u0000\u0000\u0000\u00a7"+ - "\u00a8\u0005p\u0000\u0000\u00a8\u00a9\u0005u\u0000\u0000\u00a9\u00aa\u0005"+ - "b\u0000\u0000\u00aa\u00ab\u0005l\u0000\u0000\u00ab\u00ac\u0005i\u0000"+ - "\u0000\u00ac\u00ad\u0005c\u0000\u0000\u00ad,\u0001\u0000\u0000\u0000\u00ae"+ - "\u00af\u0005n\u0000\u0000\u00af\u00b0\u0005e\u0000\u0000\u00b0\u00b1\u0005"+ - "w\u0000\u0000\u00b1.\u0001\u0000\u0000\u0000\u00b2\u00b3\u0005-\u0000"+ - "\u0000\u00b30\u0001\u0000\u0000\u0000\u00b4\u00b5\u0005+\u0000\u0000\u00b5"+ - "2\u0001\u0000\u0000\u0000\u00b6\u00b7\u0005*\u0000\u0000\u00b74\u0001"+ - "\u0000\u0000\u0000\u00b8\u00b9\u0005i\u0000\u0000\u00b9\u00ba\u0005n\u0000"+ - "\u0000\u00ba\u00bb\u0005t\u0000\u0000\u00bb6\u0001\u0000\u0000\u0000\u00bc"+ - "\u00bd\u0005b\u0000\u0000\u00bd\u00be\u0005o\u0000\u0000\u00be\u00bf\u0005"+ - "o\u0000\u0000\u00bf\u00c0\u0005l\u0000\u0000\u00c0\u00c1\u0005e\u0000"+ - "\u0000\u00c1\u00c2\u0005a\u0000\u0000\u00c2\u00c3\u0005n\u0000\u0000\u00c3"+ - "8\u0001\u0000\u0000\u0000\u00c4\u00c5\u0005v\u0000\u0000\u00c5\u00c6\u0005"+ - "o\u0000\u0000\u00c6\u00c7\u0005i\u0000\u0000\u00c7\u00c8\u0005d\u0000"+ - "\u0000\u00c8:\u0001\u0000\u0000\u0000\u00c9\u00ca\u0007\u0000\u0000\u0000"+ - "\u00ca\u00cb\u0007\u0001\u0000\u0000\u00cb\u00cc\u0007\u0000\u0000\u0000"+ - "\u00cc<\u0001\u0000\u0000\u0000\u00cd\u00cf\u0007\u0001\u0000\u0000\u00ce"+ - "\u00cd\u0001\u0000\u0000\u0000\u00cf\u00d0\u0001\u0000\u0000\u0000\u00d0"+ - "\u00ce\u0001\u0000\u0000\u0000\u00d0\u00d1\u0001\u0000\u0000\u0000\u00d1"+ - ">\u0001\u0000\u0000\u0000\u00d2\u00d4\u0007\u0002\u0000\u0000\u00d3\u00d2"+ - "\u0001\u0000\u0000\u0000\u00d4\u00d5\u0001\u0000\u0000\u0000\u00d5\u00d3"+ - "\u0001\u0000\u0000\u0000\u00d5\u00d6\u0001\u0000\u0000\u0000\u00d6@\u0001"+ - "\u0000\u0000\u0000\u00d7\u00d8\u0007\u0003\u0000\u0000\u00d8\u00d9\u0001"+ - "\u0000\u0000\u0000\u00d9\u00da\u0006 \u0000\u0000\u00daB\u0001\u0000\u0000"+ - "\u0000\u0003\u0000\u00d0\u00d5\u0001\u0006\u0000\u0000"; + "9\u001d;\u001e=\u001f? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_0\u0001\u0000"+ + "\u0004\u0001\u0000\'\'\u0002\u0000AZaz\u0001\u000009\u0003\u0000\t\n\r"+ + "\r \u012d\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\u0000"+ + "3\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\u0000"+ + "A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001"+ + "\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000"+ + "\u0000\u0000K\u0001\u0000\u0000\u0000\u0000M\u0001\u0000\u0000\u0000\u0000"+ + "O\u0001\u0000\u0000\u0000\u0000Q\u0001\u0000\u0000\u0000\u0000S\u0001"+ + "\u0000\u0000\u0000\u0000U\u0001\u0000\u0000\u0000\u0000W\u0001\u0000\u0000"+ + "\u0000\u0000Y\u0001\u0000\u0000\u0000\u0000[\u0001\u0000\u0000\u0000\u0000"+ + "]\u0001\u0000\u0000\u0000\u0000_\u0001\u0000\u0000\u0000\u0001a\u0001"+ + "\u0000\u0000\u0000\u0003g\u0001\u0000\u0000\u0000\u0005i\u0001\u0000\u0000"+ + "\u0000\u0007k\u0001\u0000\u0000\u0000\tm\u0001\u0000\u0000\u0000\u000b"+ + "o\u0001\u0000\u0000\u0000\rq\u0001\u0000\u0000\u0000\u000fx\u0001\u0000"+ + "\u0000\u0000\u0011}\u0001\u0000\u0000\u0000\u0013\u008b\u0001\u0000\u0000"+ + "\u0000\u0015\u008d\u0001\u0000\u0000\u0000\u0017\u0090\u0001\u0000\u0000"+ + "\u0000\u0019\u0095\u0001\u0000\u0000\u0000\u001b\u0099\u0001\u0000\u0000"+ + "\u0000\u001d\u009f\u0001\u0000\u0000\u0000\u001f\u00a2\u0001\u0000\u0000"+ + "\u0000!\u00a9\u0001\u0000\u0000\u0000#\u00af\u0001\u0000\u0000\u0000%"+ + "\u00b8\u0001\u0000\u0000\u0000\'\u00ba\u0001\u0000\u0000\u0000)\u00c1"+ + "\u0001\u0000\u0000\u0000+\u00c5\u0001\u0000\u0000\u0000-\u00ca\u0001\u0000"+ + "\u0000\u0000/\u00cf\u0001\u0000\u0000\u00001\u00d1\u0001\u0000\u0000\u0000"+ + "3\u00d3\u0001\u0000\u0000\u00005\u00d5\u0001\u0000\u0000\u00007\u00d7"+ + "\u0001\u0000\u0000\u00009\u00d9\u0001\u0000\u0000\u0000;\u00dc\u0001\u0000"+ + "\u0000\u0000=\u00df\u0001\u0000\u0000\u0000?\u00e2\u0001\u0000\u0000\u0000"+ + "A\u00e5\u0001\u0000\u0000\u0000C\u00e8\u0001\u0000\u0000\u0000E\u00eb"+ + "\u0001\u0000\u0000\u0000G\u00ed\u0001\u0000\u0000\u0000I\u00f0\u0001\u0000"+ + "\u0000\u0000K\u00f3\u0001\u0000\u0000\u0000M\u00f6\u0001\u0000\u0000\u0000"+ + "O\u00f8\u0001\u0000\u0000\u0000Q\u00fc\u0001\u0000\u0000\u0000S\u0104"+ + "\u0001\u0000\u0000\u0000U\u0109\u0001\u0000\u0000\u0000W\u0117\u0001\u0000"+ + "\u0000\u0000Y\u0119\u0001\u0000\u0000\u0000[\u011e\u0001\u0000\u0000\u0000"+ + "]\u0123\u0001\u0000\u0000\u0000_\u0127\u0001\u0000\u0000\u0000ab\u0005"+ + "c\u0000\u0000bc\u0005l\u0000\u0000cd\u0005a\u0000\u0000de\u0005s\u0000"+ + "\u0000ef\u0005s\u0000\u0000f\u0002\u0001\u0000\u0000\u0000gh\u0005{\u0000"+ + "\u0000h\u0004\u0001\u0000\u0000\u0000ij\u0005}\u0000\u0000j\u0006\u0001"+ + "\u0000\u0000\u0000kl\u0005;\u0000\u0000l\b\u0001\u0000\u0000\u0000mn\u0005"+ + "(\u0000\u0000n\n\u0001\u0000\u0000\u0000op\u0005)\u0000\u0000p\f\u0001"+ + "\u0000\u0000\u0000qr\u0005s\u0000\u0000rs\u0005t\u0000\u0000st\u0005a"+ + "\u0000\u0000tu\u0005t\u0000\u0000uv\u0005i\u0000\u0000vw\u0005c\u0000"+ + "\u0000w\u000e\u0001\u0000\u0000\u0000xy\u0005m\u0000\u0000yz\u0005a\u0000"+ + "\u0000z{\u0005i\u0000\u0000{|\u0005n\u0000\u0000|\u0010\u0001\u0000\u0000"+ + "\u0000}~\u0005S\u0000\u0000~\u007f\u0005t\u0000\u0000\u007f\u0080\u0005"+ + "r\u0000\u0000\u0080\u0081\u0005i\u0000\u0000\u0081\u0082\u0005n\u0000"+ + "\u0000\u0082\u0083\u0005g\u0000\u0000\u0083\u0084\u0005[\u0000\u0000\u0084"+ + "\u0085\u0005]\u0000\u0000\u0085\u0086\u0005 \u0000\u0000\u0086\u0087\u0005"+ + "a\u0000\u0000\u0087\u0088\u0005r\u0000\u0000\u0088\u0089\u0005g\u0000"+ + "\u0000\u0089\u008a\u0005s\u0000\u0000\u008a\u0012\u0001\u0000\u0000\u0000"+ + "\u008b\u008c\u0005,\u0000\u0000\u008c\u0014\u0001\u0000\u0000\u0000\u008d"+ + "\u008e\u0005i\u0000\u0000\u008e\u008f\u0005f\u0000\u0000\u008f\u0016\u0001"+ + "\u0000\u0000\u0000\u0090\u0091\u0005e\u0000\u0000\u0091\u0092\u0005l\u0000"+ + "\u0000\u0092\u0093\u0005s\u0000\u0000\u0093\u0094\u0005e\u0000\u0000\u0094"+ + "\u0018\u0001\u0000\u0000\u0000\u0095\u0096\u0005f\u0000\u0000\u0096\u0097"+ + "\u0005o\u0000\u0000\u0097\u0098\u0005r\u0000\u0000\u0098\u001a\u0001\u0000"+ + "\u0000\u0000\u0099\u009a\u0005w\u0000\u0000\u009a\u009b\u0005h\u0000\u0000"+ + "\u009b\u009c\u0005i\u0000\u0000\u009c\u009d\u0005l\u0000\u0000\u009d\u009e"+ + "\u0005e\u0000\u0000\u009e\u001c\u0001\u0000\u0000\u0000\u009f\u00a0\u0005"+ + "d\u0000\u0000\u00a0\u00a1\u0005o\u0000\u0000\u00a1\u001e\u0001\u0000\u0000"+ + "\u0000\u00a2\u00a3\u0005r\u0000\u0000\u00a3\u00a4\u0005e\u0000\u0000\u00a4"+ + "\u00a5\u0005t\u0000\u0000\u00a5\u00a6\u0005u\u0000\u0000\u00a6\u00a7\u0005"+ + "r\u0000\u0000\u00a7\u00a8\u0005n\u0000\u0000\u00a8 \u0001\u0000\u0000"+ + "\u0000\u00a9\u00aa\u0005b\u0000\u0000\u00aa\u00ab\u0005r\u0000\u0000\u00ab"+ + "\u00ac\u0005e\u0000\u0000\u00ac\u00ad\u0005a\u0000\u0000\u00ad\u00ae\u0005"+ + "k\u0000\u0000\u00ae\"\u0001\u0000\u0000\u0000\u00af\u00b0\u0005c\u0000"+ + "\u0000\u00b0\u00b1\u0005o\u0000\u0000\u00b1\u00b2\u0005n\u0000\u0000\u00b2"+ + "\u00b3\u0005t\u0000\u0000\u00b3\u00b4\u0005i\u0000\u0000\u00b4\u00b5\u0005"+ + "n\u0000\u0000\u00b5\u00b6\u0005u\u0000\u0000\u00b6\u00b7\u0005e\u0000"+ + "\u0000\u00b7$\u0001\u0000\u0000\u0000\u00b8\u00b9\u0005.\u0000\u0000\u00b9"+ + "&\u0001\u0000\u0000\u0000\u00ba\u00bb\u0005p\u0000\u0000\u00bb\u00bc\u0005"+ + "u\u0000\u0000\u00bc\u00bd\u0005b\u0000\u0000\u00bd\u00be\u0005l\u0000"+ + "\u0000\u00be\u00bf\u0005i\u0000\u0000\u00bf\u00c0\u0005c\u0000\u0000\u00c0"+ + "(\u0001\u0000\u0000\u0000\u00c1\u00c2\u0005n\u0000\u0000\u00c2\u00c3\u0005"+ + "e\u0000\u0000\u00c3\u00c4\u0005w\u0000\u0000\u00c4*\u0001\u0000\u0000"+ + "\u0000\u00c5\u00c6\u0005n\u0000\u0000\u00c6\u00c7\u0005u\u0000\u0000\u00c7"+ + "\u00c8\u0005l\u0000\u0000\u00c8\u00c9\u0005l\u0000\u0000\u00c9,\u0001"+ + "\u0000\u0000\u0000\u00ca\u00cb\u0005t\u0000\u0000\u00cb\u00cc\u0005h\u0000"+ + "\u0000\u00cc\u00cd\u0005i\u0000\u0000\u00cd\u00ce\u0005s\u0000\u0000\u00ce"+ + ".\u0001\u0000\u0000\u0000\u00cf\u00d0\u0005-\u0000\u0000\u00d00\u0001"+ + "\u0000\u0000\u0000\u00d1\u00d2\u0005+\u0000\u0000\u00d22\u0001\u0000\u0000"+ + "\u0000\u00d3\u00d4\u0005*\u0000\u0000\u00d44\u0001\u0000\u0000\u0000\u00d5"+ + "\u00d6\u0005>\u0000\u0000\u00d66\u0001\u0000\u0000\u0000\u00d7\u00d8\u0005"+ + "<\u0000\u0000\u00d88\u0001\u0000\u0000\u0000\u00d9\u00da\u0005>\u0000"+ + "\u0000\u00da\u00db\u0005=\u0000\u0000\u00db:\u0001\u0000\u0000\u0000\u00dc"+ + "\u00dd\u0005<\u0000\u0000\u00dd\u00de\u0005=\u0000\u0000\u00de<\u0001"+ + "\u0000\u0000\u0000\u00df\u00e0\u0005=\u0000\u0000\u00e0\u00e1\u0005=\u0000"+ + "\u0000\u00e1>\u0001\u0000\u0000\u0000\u00e2\u00e3\u0005!\u0000\u0000\u00e3"+ + "\u00e4\u0005=\u0000\u0000\u00e4@\u0001\u0000\u0000\u0000\u00e5\u00e6\u0005"+ + "&\u0000\u0000\u00e6\u00e7\u0005&\u0000\u0000\u00e7B\u0001\u0000\u0000"+ + "\u0000\u00e8\u00e9\u0005|\u0000\u0000\u00e9\u00ea\u0005|\u0000\u0000\u00ea"+ + "D\u0001\u0000\u0000\u0000\u00eb\u00ec\u0005=\u0000\u0000\u00ecF\u0001"+ + "\u0000\u0000\u0000\u00ed\u00ee\u0005+\u0000\u0000\u00ee\u00ef\u0005=\u0000"+ + "\u0000\u00efH\u0001\u0000\u0000\u0000\u00f0\u00f1\u0005-\u0000\u0000\u00f1"+ + "\u00f2\u0005=\u0000\u0000\u00f2J\u0001\u0000\u0000\u0000\u00f3\u00f4\u0005"+ + "*\u0000\u0000\u00f4\u00f5\u0005=\u0000\u0000\u00f5L\u0001\u0000\u0000"+ + "\u0000\u00f6\u00f7\u0005!\u0000\u0000\u00f7N\u0001\u0000\u0000\u0000\u00f8"+ + "\u00f9\u0005i\u0000\u0000\u00f9\u00fa\u0005n\u0000\u0000\u00fa\u00fb\u0005"+ + "t\u0000\u0000\u00fbP\u0001\u0000\u0000\u0000\u00fc\u00fd\u0005b\u0000"+ + "\u0000\u00fd\u00fe\u0005o\u0000\u0000\u00fe\u00ff\u0005o\u0000\u0000\u00ff"+ + "\u0100\u0005l\u0000\u0000\u0100\u0101\u0005e\u0000\u0000\u0101\u0102\u0005"+ + "a\u0000\u0000\u0102\u0103\u0005n\u0000\u0000\u0103R\u0001\u0000\u0000"+ + "\u0000\u0104\u0105\u0005v\u0000\u0000\u0105\u0106\u0005o\u0000\u0000\u0106"+ + "\u0107\u0005i\u0000\u0000\u0107\u0108\u0005d\u0000\u0000\u0108T\u0001"+ + "\u0000\u0000\u0000\u0109\u010a\u0005c\u0000\u0000\u010a\u010b\u0005h\u0000"+ + "\u0000\u010b\u010c\u0005a\u0000\u0000\u010c\u010d\u0005r\u0000\u0000\u010d"+ + "V\u0001\u0000\u0000\u0000\u010e\u010f\u0005t\u0000\u0000\u010f\u0110\u0005"+ + "r\u0000\u0000\u0110\u0111\u0005u\u0000\u0000\u0111\u0118\u0005e\u0000"+ + "\u0000\u0112\u0113\u0005f\u0000\u0000\u0113\u0114\u0005a\u0000\u0000\u0114"+ + "\u0115\u0005l\u0000\u0000\u0115\u0116\u0005s\u0000\u0000\u0116\u0118\u0005"+ + "e\u0000\u0000\u0117\u010e\u0001\u0000\u0000\u0000\u0117\u0112\u0001\u0000"+ + "\u0000\u0000\u0118X\u0001\u0000\u0000\u0000\u0119\u011a\u0007\u0000\u0000"+ + "\u0000\u011a\u011b\u0007\u0001\u0000\u0000\u011b\u011c\u0007\u0000\u0000"+ + "\u0000\u011cZ\u0001\u0000\u0000\u0000\u011d\u011f\u0007\u0001\u0000\u0000"+ + "\u011e\u011d\u0001\u0000\u0000\u0000\u011f\u0120\u0001\u0000\u0000\u0000"+ + "\u0120\u011e\u0001\u0000\u0000\u0000\u0120\u0121\u0001\u0000\u0000\u0000"+ + "\u0121\\\u0001\u0000\u0000\u0000\u0122\u0124\u0007\u0002\u0000\u0000\u0123"+ + "\u0122\u0001\u0000\u0000\u0000\u0124\u0125\u0001\u0000\u0000\u0000\u0125"+ + "\u0123\u0001\u0000\u0000\u0000\u0125\u0126\u0001\u0000\u0000\u0000\u0126"+ + "^\u0001\u0000\u0000\u0000\u0127\u0128\u0007\u0003\u0000\u0000\u0128\u0129"+ + "\u0001\u0000\u0000\u0000\u0129\u012a\u0006/\u0000\u0000\u012a`\u0001\u0000"+ + "\u0000\u0000\u0004\u0000\u0117\u0120\u0125\u0001\u0006\u0000\u0000"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/de/maishai/antlr/DecafLexer.tokens b/src/main/java/de/maishai/antlr/DecafLexer.tokens index 2f81403..78b9736 100644 --- a/src/main/java/de/maishai/antlr/DecafLexer.tokens +++ b/src/main/java/de/maishai/antlr/DecafLexer.tokens @@ -17,46 +17,75 @@ T__15=16 T__16=17 T__17=18 T__18=19 -T__19=20 -T__20=21 -PUBLIC=22 -NEW=23 +PUBLIC=20 +NEW=21 +NULL=22 +THIS=23 SUB=24 ADD=25 MUL=26 -INT=27 -BOOL=28 -VOID=29 -CHAR=30 -IDENTIFIER=31 -NUMBER=32 -WS=33 +GT=27 +LT=28 +GE=29 +LE=30 +EQ=31 +NE=32 +AND=33 +OR=34 +ASSIGN=35 +ADD_ASSIGN=36 +SUB_ASSIGN=37 +MUL_ASSIGN=38 +NOT=39 +INT=40 +BOOL=41 +VOID=42 +CHAR=43 +BOOLEANLITERAL=44 +CHARLITERAL=45 +IDENTIFIER=46 +NUMBER=47 +WS=48 'class'=1 '{'=2 '}'=3 ';'=4 -'='=5 -'('=6 -')'=7 -'static'=8 -'main'=9 -'String[] args'=10 -','=11 -'if'=12 -'else'=13 -'for'=14 -'while'=15 -'do'=16 -'return'=17 -'break'=18 -'continue'=19 -'true'=20 -'false'=21 -'public'=22 -'new'=23 +'('=5 +')'=6 +'static'=7 +'main'=8 +'String[] args'=9 +','=10 +'if'=11 +'else'=12 +'for'=13 +'while'=14 +'do'=15 +'return'=16 +'break'=17 +'continue'=18 +'.'=19 +'public'=20 +'new'=21 +'null'=22 +'this'=23 '-'=24 '+'=25 '*'=26 -'int'=27 -'boolean'=28 -'void'=29 +'>'=27 +'<'=28 +'>='=29 +'<='=30 +'=='=31 +'!='=32 +'&&'=33 +'||'=34 +'='=35 +'+='=36 +'-='=37 +'*='=38 +'!'=39 +'int'=40 +'boolean'=41 +'void'=42 +'char'=43 diff --git a/src/main/java/de/maishai/antlr/DecafListener.java b/src/main/java/de/maishai/antlr/DecafListener.java index e6a6fed..25c125e 100644 --- a/src/main/java/de/maishai/antlr/DecafListener.java +++ b/src/main/java/de/maishai/antlr/DecafListener.java @@ -28,15 +28,35 @@ public interface DecafListener extends ParseTreeListener { */ void exitClass(DecafParser.ClassContext ctx); /** - * Enter a parse tree produced by {@link DecafParser#var}. + * Enter a parse tree produced by {@link DecafParser#field}. * @param ctx the parse tree */ - void enterVar(DecafParser.VarContext ctx); + void enterField(DecafParser.FieldContext ctx); /** - * Exit a parse tree produced by {@link DecafParser#var}. + * Exit a parse tree produced by {@link DecafParser#field}. * @param ctx the parse tree */ - void exitVar(DecafParser.VarContext ctx); + void exitField(DecafParser.FieldContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#localVar}. + * @param ctx the parse tree + */ + void enterLocalVar(DecafParser.LocalVarContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#localVar}. + * @param ctx the parse tree + */ + void exitLocalVar(DecafParser.LocalVarContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#assignSign}. + * @param ctx the parse tree + */ + void enterAssignSign(DecafParser.AssignSignContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#assignSign}. + * @param ctx the parse tree + */ + void exitAssignSign(DecafParser.AssignSignContext ctx); /** * Enter a parse tree produced by {@link DecafParser#returntype}. * @param ctx the parse tree @@ -77,6 +97,16 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitMainmeth(DecafParser.MainmethContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#constructor}. + * @param ctx the parse tree + */ + void enterConstructor(DecafParser.ConstructorContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#constructor}. + * @param ctx the parse tree + */ + void exitConstructor(DecafParser.ConstructorContext ctx); /** * Enter a parse tree produced by {@link DecafParser#params}. * @param ctx the parse tree @@ -203,6 +233,18 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitContinue(DecafParser.ContinueContext ctx); + /** + * Enter a parse tree produced by the {@code Assignment} + * labeled alternative in {@link DecafParser#stmt}. + * @param ctx the parse tree + */ + void enterAssignment(DecafParser.AssignmentContext ctx); + /** + * Exit a parse tree produced by the {@code Assignment} + * labeled alternative in {@link DecafParser#stmt}. + * @param ctx the parse tree + */ + void exitAssignment(DecafParser.AssignmentContext ctx); /** * Enter a parse tree produced by the {@code StatementExpressionstmt} * labeled alternative in {@link DecafParser#stmt}. @@ -215,18 +257,6 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx); - /** - * Enter a parse tree produced by the {@code Assign} - * labeled alternative in {@link DecafParser#stmtexpr}. - * @param ctx the parse tree - */ - void enterAssign(DecafParser.AssignContext ctx); - /** - * Exit a parse tree produced by the {@code Assign} - * labeled alternative in {@link DecafParser#stmtexpr}. - * @param ctx the parse tree - */ - void exitAssign(DecafParser.AssignContext ctx); /** * Enter a parse tree produced by the {@code MethodCall} * labeled alternative in {@link DecafParser#stmtexpr}. @@ -251,6 +281,30 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitNew(DecafParser.NewContext ctx); + /** + * Enter a parse tree produced by the {@code Null} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + */ + void enterNull(DecafParser.NullContext ctx); + /** + * Exit a parse tree produced by the {@code Null} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + */ + void exitNull(DecafParser.NullContext ctx); + /** + * Enter a parse tree produced by the {@code UnaryOperation} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + */ + void enterUnaryOperation(DecafParser.UnaryOperationContext ctx); + /** + * Exit a parse tree produced by the {@code UnaryOperation} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + */ + void exitUnaryOperation(DecafParser.UnaryOperationContext ctx); /** * Enter a parse tree produced by the {@code Identifier} * labeled alternative in {@link DecafParser#expr}. @@ -263,18 +317,6 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitIdentifier(DecafParser.IdentifierContext ctx); - /** - * Enter a parse tree produced by the {@code MethodCallExpression} - * labeled alternative in {@link DecafParser#expr}. - * @param ctx the parse tree - */ - void enterMethodCallExpression(DecafParser.MethodCallExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code MethodCallExpression} - * labeled alternative in {@link DecafParser#expr}. - * @param ctx the parse tree - */ - void exitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx); /** * Enter a parse tree produced by the {@code Expression} * labeled alternative in {@link DecafParser#expr}. @@ -333,6 +375,26 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitBinaryOp(DecafParser.BinaryOpContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#unaryOp}. + * @param ctx the parse tree + */ + void enterUnaryOp(DecafParser.UnaryOpContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#unaryOp}. + * @param ctx the parse tree + */ + void exitUnaryOp(DecafParser.UnaryOpContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#fieldId}. + * @param ctx the parse tree + */ + void enterFieldId(DecafParser.FieldIdContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#fieldId}. + * @param ctx the parse tree + */ + void exitFieldId(DecafParser.FieldIdContext ctx); /** * Enter a parse tree produced by {@link DecafParser#methCall}. * @param ctx the parse tree @@ -343,6 +405,26 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitMethCall(DecafParser.MethCallContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#recipient}. + * @param ctx the parse tree + */ + void enterRecipient(DecafParser.RecipientContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#recipient}. + * @param ctx the parse tree + */ + void exitRecipient(DecafParser.RecipientContext ctx); + /** + * Enter a parse tree produced by {@link DecafParser#methName}. + * @param ctx the parse tree + */ + void enterMethName(DecafParser.MethNameContext ctx); + /** + * Exit a parse tree produced by {@link DecafParser#methName}. + * @param ctx the parse tree + */ + void exitMethName(DecafParser.MethNameContext ctx); /** * Enter a parse tree produced by {@link DecafParser#args}. * @param ctx the parse tree @@ -363,16 +445,6 @@ public interface DecafListener extends ParseTreeListener { * @param ctx the parse tree */ void exitLiteral(DecafParser.LiteralContext ctx); - /** - * Enter a parse tree produced by {@link DecafParser#boolean}. - * @param ctx the parse tree - */ - void enterBoolean(DecafParser.BooleanContext ctx); - /** - * Exit a parse tree produced by {@link DecafParser#boolean}. - * @param ctx the parse tree - */ - void exitBoolean(DecafParser.BooleanContext ctx); /** * Enter a parse tree produced by {@link DecafParser#id}. * @param ctx the parse tree diff --git a/src/main/java/de/maishai/antlr/DecafParser.java b/src/main/java/de/maishai/antlr/DecafParser.java index 37e0da2..3629a6e 100644 --- a/src/main/java/de/maishai/antlr/DecafParser.java +++ b/src/main/java/de/maishai/antlr/DecafParser.java @@ -19,37 +19,46 @@ public class DecafParser extends Parser { public static final int 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, PUBLIC=22, NEW=23, SUB=24, ADD=25, - MUL=26, INT=27, BOOL=28, VOID=29, CHAR=30, IDENTIFIER=31, NUMBER=32, WS=33; + T__17=18, T__18=19, PUBLIC=20, NEW=21, NULL=22, THIS=23, SUB=24, ADD=25, + MUL=26, GT=27, LT=28, GE=29, LE=30, EQ=31, NE=32, AND=33, OR=34, ASSIGN=35, + ADD_ASSIGN=36, SUB_ASSIGN=37, MUL_ASSIGN=38, NOT=39, INT=40, BOOL=41, + VOID=42, CHAR=43, BOOLEANLITERAL=44, CHARLITERAL=45, IDENTIFIER=46, NUMBER=47, + WS=48; public static final int - RULE_program = 0, RULE_class = 1, RULE_var = 2, RULE_returntype = 3, RULE_type = 4, - RULE_meth = 5, RULE_mainmeth = 6, RULE_params = 7, RULE_param = 8, RULE_block = 9, - RULE_stmt = 10, RULE_stmtexpr = 11, RULE_expr = 12, RULE_binaryOp = 13, - RULE_methCall = 14, RULE_args = 15, RULE_literal = 16, RULE_boolean = 17, - RULE_id = 18; + RULE_program = 0, RULE_class = 1, RULE_field = 2, RULE_localVar = 3, RULE_assignSign = 4, + RULE_returntype = 5, RULE_type = 6, RULE_meth = 7, RULE_mainmeth = 8, + RULE_constructor = 9, RULE_params = 10, RULE_param = 11, RULE_block = 12, + RULE_stmt = 13, RULE_stmtexpr = 14, RULE_expr = 15, RULE_binaryOp = 16, + RULE_unaryOp = 17, RULE_fieldId = 18, RULE_methCall = 19, RULE_recipient = 20, + RULE_methName = 21, RULE_args = 22, RULE_literal = 23, RULE_id = 24; private static String[] makeRuleNames() { return new String[] { - "program", "class", "var", "returntype", "type", "meth", "mainmeth", - "params", "param", "block", "stmt", "stmtexpr", "expr", "binaryOp", "methCall", - "args", "literal", "boolean", "id" + "program", "class", "field", "localVar", "assignSign", "returntype", + "type", "meth", "mainmeth", "constructor", "params", "param", "block", + "stmt", "stmtexpr", "expr", "binaryOp", "unaryOp", "fieldId", "methCall", + "recipient", "methName", "args", "literal", "id" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, "'class'", "'{'", "'}'", "';'", "'='", "'('", "')'", "'static'", - "'main'", "'String[] args'", "','", "'if'", "'else'", "'for'", "'while'", - "'do'", "'return'", "'break'", "'continue'", "'true'", "'false'", "'public'", - "'new'", "'-'", "'+'", "'*'", "'int'", "'boolean'", "'void'" + null, "'class'", "'{'", "'}'", "';'", "'('", "')'", "'static'", "'main'", + "'String[] args'", "','", "'if'", "'else'", "'for'", "'while'", "'do'", + "'return'", "'break'", "'continue'", "'.'", "'public'", "'new'", "'null'", + "'this'", "'-'", "'+'", "'*'", "'>'", "'<'", "'>='", "'<='", "'=='", + "'!='", "'&&'", "'||'", "'='", "'+='", "'-='", "'*='", "'!'", "'int'", + "'boolean'", "'void'", "'char'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, "PUBLIC", - "NEW", "SUB", "ADD", "MUL", "INT", "BOOL", "VOID", "CHAR", "IDENTIFIER", + null, null, null, null, null, null, null, null, "PUBLIC", "NEW", "NULL", + "THIS", "SUB", "ADD", "MUL", "GT", "LT", "GE", "LE", "EQ", "NE", "AND", + "OR", "ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "NOT", "INT", + "BOOL", "VOID", "CHAR", "BOOLEANLITERAL", "CHARLITERAL", "IDENTIFIER", "NUMBER", "WS" }; } @@ -138,17 +147,17 @@ public class DecafParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(39); + setState(51); _errHandler.sync(this); _la = _input.LA(1); do { { { - setState(38); + setState(50); class_(); } } - setState(41); + setState(53); _errHandler.sync(this); _la = _input.LA(1); } while ( _la==T__0 || _la==PUBLIC ); @@ -170,12 +179,15 @@ public class DecafParser extends Parser { public IdContext id() { return getRuleContext(IdContext.class,0); } - public TerminalNode PUBLIC() { return getToken(DecafParser.PUBLIC, 0); } - public List var() { - return getRuleContexts(VarContext.class); + public MainmethContext mainmeth() { + return getRuleContext(MainmethContext.class,0); } - public VarContext var(int i) { - return getRuleContext(VarContext.class,i); + public TerminalNode PUBLIC() { return getToken(DecafParser.PUBLIC, 0); } + public List field() { + return getRuleContexts(FieldContext.class); + } + public FieldContext field(int i) { + return getRuleContext(FieldContext.class,i); } public List meth() { return getRuleContexts(MethContext.class); @@ -183,6 +195,12 @@ public class DecafParser extends Parser { public MethContext meth(int i) { return getRuleContext(MethContext.class,i); } + public List constructor() { + return getRuleContexts(ConstructorContext.class); + } + public ConstructorContext constructor(int i) { + return getRuleContext(ConstructorContext.class,i); + } public ClassContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @@ -209,49 +227,57 @@ public class DecafParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(44); + setState(56); _errHandler.sync(this); _la = _input.LA(1); if (_la==PUBLIC) { { - setState(43); + setState(55); match(PUBLIC); } } - setState(46); + setState(58); match(T__0); - setState(47); + setState(59); id(); - setState(48); + setState(60); match(T__1); - setState(53); + setState(61); + mainmeth(); + setState(67); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 2017460224L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 86861419642880L) != 0)) { { - setState(51); + setState(65); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { case 1: { - setState(49); - var(); + setState(62); + field(); } break; case 2: { - setState(50); + setState(63); meth(); } break; + case 3: + { + setState(64); + constructor(); + } + break; } } - setState(55); + setState(69); _errHandler.sync(this); _la = _input.LA(1); } - setState(56); + setState(70); match(T__2); } } @@ -267,68 +293,151 @@ public class DecafParser extends Parser { } @SuppressWarnings("CheckReturnValue") - public static class VarContext extends ParserRuleContext { + public static class FieldContext extends ParserRuleContext { public TypeContext type() { return getRuleContext(TypeContext.class,0); } public IdContext id() { return getRuleContext(IdContext.class,0); } - public ExprContext expr() { - return getRuleContext(ExprContext.class,0); - } - public VarContext(ParserRuleContext parent, int invokingState) { + public FieldContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } - @Override public int getRuleIndex() { return RULE_var; } + @Override public int getRuleIndex() { return RULE_field; } @Override public void enterRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).enterVar(this); + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterField(this); } @Override public void exitRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).exitVar(this); + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitField(this); } @Override public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitVar(this); + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitField(this); else return visitor.visitChildren(this); } } - public final VarContext var() throws RecognitionException { - VarContext _localctx = new VarContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_var); + public final FieldContext field() throws RecognitionException { + FieldContext _localctx = new FieldContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_field); try { - setState(68); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(58); - type(); - setState(59); - id(); - setState(60); - match(T__3); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(62); - type(); - setState(63); - id(); - setState(64); - match(T__4); - setState(65); - expr(0); - setState(66); - match(T__3); - } - break; + enterOuterAlt(_localctx, 1); + { + setState(72); + type(); + setState(73); + id(); + setState(74); + 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 LocalVarContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public IdContext id() { + return getRuleContext(IdContext.class,0); + } + public LocalVarContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_localVar; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterLocalVar(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitLocalVar(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitLocalVar(this); + else return visitor.visitChildren(this); + } + } + + public final LocalVarContext localVar() throws RecognitionException { + LocalVarContext _localctx = new LocalVarContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_localVar); + try { + enterOuterAlt(_localctx, 1); + { + setState(76); + type(); + setState(77); + id(); + setState(78); + 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 AssignSignContext extends ParserRuleContext { + public TerminalNode ASSIGN() { return getToken(DecafParser.ASSIGN, 0); } + public TerminalNode ADD_ASSIGN() { return getToken(DecafParser.ADD_ASSIGN, 0); } + public TerminalNode SUB_ASSIGN() { return getToken(DecafParser.SUB_ASSIGN, 0); } + public TerminalNode MUL_ASSIGN() { return getToken(DecafParser.MUL_ASSIGN, 0); } + public AssignSignContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_assignSign; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterAssignSign(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitAssignSign(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitAssignSign(this); + else return visitor.visitChildren(this); + } + } + + public final AssignSignContext assignSign() throws RecognitionException { + AssignSignContext _localctx = new AssignSignContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_assignSign); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(80); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 515396075520L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } } } catch (RecognitionException re) { @@ -369,9 +478,9 @@ public class DecafParser extends Parser { public final ReturntypeContext returntype() throws RecognitionException { ReturntypeContext _localctx = new ReturntypeContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_returntype); + enterRule(_localctx, 10, RULE_returntype); try { - setState(72); + setState(84); _errHandler.sync(this); switch (_input.LA(1)) { case INT: @@ -379,14 +488,14 @@ public class DecafParser extends Parser { case CHAR: enterOuterAlt(_localctx, 1); { - setState(70); + setState(82); type(); } break; case VOID: enterOuterAlt(_localctx, 2); { - setState(71); + setState(83); match(VOID); } break; @@ -431,14 +540,14 @@ public class DecafParser extends Parser { public final TypeContext type() throws RecognitionException { TypeContext _localctx = new TypeContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_type); + enterRule(_localctx, 12, RULE_type); int _la; try { enterOuterAlt(_localctx, 1); { - setState(74); + setState(86); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 1476395008L) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 12094627905536L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -474,9 +583,6 @@ public class DecafParser extends Parser { public ParamsContext params() { return getRuleContext(ParamsContext.class,0); } - public MainmethContext mainmeth() { - return getRuleContext(MainmethContext.class,0); - } public MethContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @@ -498,54 +604,41 @@ public class DecafParser extends Parser { public final MethContext meth() throws RecognitionException { MethContext _localctx = new MethContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_meth); + enterRule(_localctx, 14, RULE_meth); int _la; try { + enterOuterAlt(_localctx, 1); + { setState(89); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(77); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PUBLIC) { - { - setState(76); - match(PUBLIC); - } - } - - setState(79); - returntype(); - setState(80); - id(); - setState(81); - match(T__5); - setState(83); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1476395008L) != 0)) { - { - setState(82); - params(); - } - } - - setState(85); - match(T__6); - setState(86); - block(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); + _la = _input.LA(1); + if (_la==PUBLIC) { { setState(88); - mainmeth(); + match(PUBLIC); } - break; + } + + setState(91); + returntype(); + setState(92); + id(); + setState(93); + match(T__4); + setState(95); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 12094627905536L) != 0)) { + { + setState(94); + params(); + } + } + + setState(97); + match(T__5); + setState(98); + block(); } } catch (RecognitionException re) { @@ -587,25 +680,104 @@ public class DecafParser extends Parser { public final MainmethContext mainmeth() throws RecognitionException { MainmethContext _localctx = new MainmethContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_mainmeth); + enterRule(_localctx, 16, RULE_mainmeth); try { enterOuterAlt(_localctx, 1); { - setState(91); + setState(100); match(PUBLIC); - setState(92); - match(T__7); - setState(93); - match(VOID); - setState(94); - match(T__8); - setState(95); - match(T__5); - setState(96); - match(T__9); - setState(97); + setState(101); match(T__6); - setState(98); + setState(102); + match(VOID); + setState(103); + match(T__7); + setState(104); + match(T__4); + setState(105); + match(T__8); + setState(106); + match(T__5); + setState(107); + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstructorContext extends ParserRuleContext { + public IdContext id() { + return getRuleContext(IdContext.class,0); + } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public TerminalNode PUBLIC() { return getToken(DecafParser.PUBLIC, 0); } + public ParamsContext params() { + return getRuleContext(ParamsContext.class,0); + } + public ConstructorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constructor; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterConstructor(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitConstructor(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitConstructor(this); + else return visitor.visitChildren(this); + } + } + + public final ConstructorContext constructor() throws RecognitionException { + ConstructorContext _localctx = new ConstructorContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_constructor); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(110); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==PUBLIC) { + { + setState(109); + match(PUBLIC); + } + } + + setState(112); + id(); + setState(113); + match(T__4); + setState(115); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 12094627905536L) != 0)) { + { + setState(114); + params(); + } + } + + setState(117); + match(T__5); + setState(118); block(); } } @@ -649,26 +821,26 @@ public class DecafParser extends Parser { public final ParamsContext params() throws RecognitionException { ParamsContext _localctx = new ParamsContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_params); + enterRule(_localctx, 20, RULE_params); int _la; try { enterOuterAlt(_localctx, 1); { - setState(100); + setState(120); param(); - setState(105); + setState(125); _errHandler.sync(this); _la = _input.LA(1); - while (_la==T__10) { + while (_la==T__9) { { { - setState(101); - match(T__10); - setState(102); + setState(121); + match(T__9); + setState(122); param(); } } - setState(107); + setState(127); _errHandler.sync(this); _la = _input.LA(1); } @@ -714,13 +886,13 @@ public class DecafParser extends Parser { public final ParamContext param() throws RecognitionException { ParamContext _localctx = new ParamContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_param); + enterRule(_localctx, 22, RULE_param); try { enterOuterAlt(_localctx, 1); { - setState(108); + setState(128); type(); - setState(109); + setState(129); id(); } } @@ -737,11 +909,11 @@ public class DecafParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class BlockContext extends ParserRuleContext { - public List var() { - return getRuleContexts(VarContext.class); + public List localVar() { + return getRuleContexts(LocalVarContext.class); } - public VarContext var(int i) { - return getRuleContext(VarContext.class,i); + public LocalVarContext localVar(int i) { + return getRuleContext(LocalVarContext.class,i); } public List stmt() { return getRuleContexts(StmtContext.class); @@ -770,40 +942,41 @@ public class DecafParser extends Parser { public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_block); + enterRule(_localctx, 24, RULE_block); int _la; try { enterOuterAlt(_localctx, 1); { - setState(111); + setState(131); match(T__1); - setState(116); + setState(136); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3633303552L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 82463383087104L) != 0)) { { - setState(114); + setState(134); _errHandler.sync(this); switch (_input.LA(1)) { case INT: case BOOL: case CHAR: { - setState(112); - var(); + setState(132); + localVar(); } break; - case T__11: + case T__10: + case T__12: case T__13: case T__14: case T__15: case T__16: case T__17: - case T__18: case NEW: + case THIS: case IDENTIFIER: { - setState(113); + setState(133); stmt(); } break; @@ -811,11 +984,11 @@ public class DecafParser extends Parser { throw new NoViableAltException(this); } } - setState(118); + setState(138); _errHandler.sync(this); _la = _input.LA(1); } - setState(119); + setState(139); match(T__2); } } @@ -843,6 +1016,32 @@ public class DecafParser extends Parser { } } @SuppressWarnings("CheckReturnValue") + public static class AssignmentContext extends StmtContext { + public IdContext id() { + return getRuleContext(IdContext.class,0); + } + public AssignSignContext assignSign() { + return getRuleContext(AssignSignContext.class,0); + } + public ExprContext expr() { + return getRuleContext(ExprContext.class,0); + } + public AssignmentContext(StmtContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterAssignment(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitAssignment(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitAssignment(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") public static class ReturnVoidContext extends StmtContext { public ReturnVoidContext(StmtContext ctx) { copyFrom(ctx); } @Override @@ -1034,34 +1233,34 @@ public class DecafParser extends Parser { public final StmtContext stmt() throws RecognitionException { StmtContext _localctx = new StmtContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_stmt); + enterRule(_localctx, 26, RULE_stmt); int _la; try { - setState(164); + setState(191); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { case 1: _localctx = new IfContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(121); - match(T__11); - setState(122); - match(T__5); - setState(123); + setState(141); + match(T__10); + setState(142); + match(T__4); + setState(143); expr(0); - setState(124); - match(T__6); - setState(125); + setState(144); + match(T__5); + setState(145); block(); - setState(128); + setState(148); _errHandler.sync(this); _la = _input.LA(1); - if (_la==T__12) { + if (_la==T__11) { { - setState(126); - match(T__12); - setState(127); + setState(146); + match(T__11); + setState(147); block(); } } @@ -1072,23 +1271,23 @@ public class DecafParser extends Parser { _localctx = new ForContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(130); - match(T__13); - setState(131); + setState(150); + match(T__12); + setState(151); + match(T__4); + setState(152); + expr(0); + setState(153); + match(T__3); + setState(154); + expr(0); + setState(155); + match(T__3); + setState(156); + expr(0); + setState(157); match(T__5); - setState(132); - expr(0); - setState(133); - match(T__3); - setState(134); - expr(0); - setState(135); - match(T__3); - setState(136); - expr(0); - setState(137); - match(T__6); - setState(138); + setState(158); block(); } break; @@ -1096,15 +1295,15 @@ public class DecafParser extends Parser { _localctx = new WhileContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(140); - match(T__14); - setState(141); - match(T__5); - setState(142); + setState(160); + match(T__13); + setState(161); + match(T__4); + setState(162); expr(0); - setState(143); - match(T__6); - setState(144); + setState(163); + match(T__5); + setState(164); block(); } break; @@ -1112,29 +1311,29 @@ public class DecafParser extends Parser { _localctx = new DoWhileContext(_localctx); enterOuterAlt(_localctx, 4); { - setState(146); - match(T__15); - setState(147); - block(); - setState(148); + setState(166); match(T__14); - setState(149); - match(T__5); - setState(150); + setState(167); + block(); + setState(168); + match(T__13); + setState(169); + match(T__4); + setState(170); expr(0); - setState(151); - match(T__6); + setState(171); + match(T__5); } break; case 5: _localctx = new ReturnContext(_localctx); enterOuterAlt(_localctx, 5); { - setState(153); - match(T__16); - setState(154); + setState(173); + match(T__15); + setState(174); expr(0); - setState(155); + setState(175); match(T__3); } break; @@ -1142,9 +1341,9 @@ public class DecafParser extends Parser { _localctx = new ReturnVoidContext(_localctx); enterOuterAlt(_localctx, 6); { - setState(157); - match(T__16); - setState(158); + setState(177); + match(T__15); + setState(178); match(T__3); } break; @@ -1152,9 +1351,9 @@ public class DecafParser extends Parser { _localctx = new BreakContext(_localctx); enterOuterAlt(_localctx, 7); { - setState(159); - match(T__17); - setState(160); + setState(179); + match(T__16); + setState(180); match(T__3); } break; @@ -1162,18 +1361,34 @@ public class DecafParser extends Parser { _localctx = new ContinueContext(_localctx); enterOuterAlt(_localctx, 8); { - setState(161); - match(T__18); - setState(162); + setState(181); + match(T__17); + setState(182); match(T__3); } break; case 9: - _localctx = new StatementExpressionstmtContext(_localctx); + _localctx = new AssignmentContext(_localctx); enterOuterAlt(_localctx, 9); { - setState(163); + setState(183); + id(); + setState(184); + assignSign(); + setState(185); + expr(0); + setState(186); + match(T__3); + } + break; + case 10: + _localctx = new StatementExpressionstmtContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(188); stmtexpr(); + setState(189); + match(T__3); } break; } @@ -1226,29 +1441,6 @@ public class DecafParser extends Parser { } } @SuppressWarnings("CheckReturnValue") - public static class AssignContext extends StmtexprContext { - public IdContext id() { - return getRuleContext(IdContext.class,0); - } - public ExprContext expr() { - return getRuleContext(ExprContext.class,0); - } - public AssignContext(StmtexprContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).enterAssign(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).exitAssign(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitAssign(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") public static class MethodCallContext extends StmtexprContext { public MethCallContext methCall() { return getRuleContext(MethCallContext.class,0); @@ -1271,60 +1463,47 @@ public class DecafParser extends Parser { public final StmtexprContext stmtexpr() throws RecognitionException { StmtexprContext _localctx = new StmtexprContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_stmtexpr); + enterRule(_localctx, 28, RULE_stmtexpr); int _la; try { - setState(182); + setState(202); _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { - case 1: - _localctx = new AssignContext(_localctx); + switch (_input.LA(1)) { + case THIS: + case IDENTIFIER: + _localctx = new MethodCallContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(166); - id(); - setState(167); - match(T__4); - setState(168); - expr(0); - setState(169); - match(T__3); + setState(193); + methCall(); } break; - case 2: - _localctx = new MethodCallContext(_localctx); + case NEW: + _localctx = new NewContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(171); - methCall(); - setState(172); - match(T__3); - } - break; - case 3: - _localctx = new NewContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(174); + setState(194); match(NEW); - setState(175); + setState(195); type(); - setState(176); - match(T__5); - setState(178); + setState(196); + match(T__4); + setState(198); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7527727168L) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 264432577937440L) != 0)) { { - setState(177); + setState(197); args(); } } - setState(180); - match(T__6); + setState(200); + match(T__5); } break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -1351,9 +1530,50 @@ public class DecafParser extends Parser { } } @SuppressWarnings("CheckReturnValue") + public static class NullContext extends ExprContext { + public TerminalNode NULL() { return getToken(DecafParser.NULL, 0); } + public NullContext(ExprContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterNull(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitNull(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitNull(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class UnaryOperationContext extends ExprContext { + public UnaryOpContext unaryOp() { + return getRuleContext(UnaryOpContext.class,0); + } + public ExprContext expr() { + return getRuleContext(ExprContext.class,0); + } + public UnaryOperationContext(ExprContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterUnaryOperation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitUnaryOperation(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitUnaryOperation(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") public static class IdentifierContext extends ExprContext { - public IdContext id() { - return getRuleContext(IdContext.class,0); + public FieldIdContext fieldId() { + return getRuleContext(FieldIdContext.class,0); } public IdentifierContext(ExprContext ctx) { copyFrom(ctx); } @Override @@ -1371,26 +1591,6 @@ public class DecafParser extends Parser { } } @SuppressWarnings("CheckReturnValue") - public static class MethodCallExpressionContext extends ExprContext { - public MethCallContext methCall() { - return getRuleContext(MethCallContext.class,0); - } - public MethodCallExpressionContext(ExprContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).enterMethodCallExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).exitMethodCallExpression(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitMethodCallExpression(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") public static class ExpressionContext extends ExprContext { public ExprContext expr() { return getRuleContext(ExprContext.class,0); @@ -1486,45 +1686,47 @@ public class DecafParser extends Parser { int _parentState = getState(); ExprContext _localctx = new ExprContext(_ctx, _parentState); ExprContext _prevctx = _localctx; - int _startState = 24; - enterRecursionRule(_localctx, 24, RULE_expr, _p); + int _startState = 30; + enterRecursionRule(_localctx, 30, RULE_expr, _p); try { int _alt; enterOuterAlt(_localctx, 1); { - setState(193); + setState(216); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { case 1: { - _localctx = new ConstantContext(_localctx); + _localctx = new UnaryOperationContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(185); - literal(); + setState(205); + unaryOp(); + setState(206); + expr(6); } break; case 2: { - _localctx = new ExpressionContext(_localctx); + _localctx = new ConstantContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(186); - match(T__5); - setState(187); - expr(0); - setState(188); - match(T__6); + setState(208); + literal(); } break; case 3: { - _localctx = new MethodCallExpressionContext(_localctx); + _localctx = new ExpressionContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(190); - methCall(); + setState(209); + match(T__4); + setState(210); + expr(0); + setState(211); + match(T__5); } break; case 4: @@ -1532,8 +1734,8 @@ public class DecafParser extends Parser { _localctx = new IdentifierContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(191); - id(); + setState(213); + fieldId(); } break; case 5: @@ -1541,13 +1743,22 @@ public class DecafParser extends Parser { _localctx = new StatementExpressionexprContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(192); + setState(214); stmtexpr(); } break; + case 6: + { + _localctx = new NullContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(215); + match(NULL); + } + break; } _ctx.stop = _input.LT(-1); - setState(201); + setState(224); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,17,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -1558,16 +1769,16 @@ public class DecafParser extends Parser { { _localctx = new BinaryOperationContext(new ExprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_expr); - setState(195); - if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); - setState(196); + setState(218); + if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(219); binaryOp(); - setState(197); - expr(7); + setState(220); + expr(8); } } } - setState(203); + setState(226); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,17,_ctx); } @@ -1589,6 +1800,14 @@ public class DecafParser extends Parser { public TerminalNode ADD() { return getToken(DecafParser.ADD, 0); } public TerminalNode SUB() { return getToken(DecafParser.SUB, 0); } public TerminalNode MUL() { return getToken(DecafParser.MUL, 0); } + public TerminalNode GT() { return getToken(DecafParser.GT, 0); } + public TerminalNode LT() { return getToken(DecafParser.LT, 0); } + public TerminalNode GE() { return getToken(DecafParser.GE, 0); } + public TerminalNode LE() { return getToken(DecafParser.LE, 0); } + public TerminalNode EQ() { return getToken(DecafParser.EQ, 0); } + public TerminalNode NE() { return getToken(DecafParser.NE, 0); } + public TerminalNode AND() { return getToken(DecafParser.AND, 0); } + public TerminalNode OR() { return getToken(DecafParser.OR, 0); } public BinaryOpContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @@ -1610,14 +1829,14 @@ public class DecafParser extends Parser { public final BinaryOpContext binaryOp() throws RecognitionException { BinaryOpContext _localctx = new BinaryOpContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_binaryOp); + enterRule(_localctx, 32, RULE_binaryOp); int _la; try { enterOuterAlt(_localctx, 1); { - setState(204); + setState(227); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 117440512L) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 34342961152L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -1639,12 +1858,153 @@ public class DecafParser extends Parser { } @SuppressWarnings("CheckReturnValue") - public static class MethCallContext extends ParserRuleContext { + public static class UnaryOpContext extends ParserRuleContext { + public TerminalNode SUB() { return getToken(DecafParser.SUB, 0); } + public TerminalNode NOT() { return getToken(DecafParser.NOT, 0); } + public UnaryOpContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_unaryOp; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterUnaryOp(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitUnaryOp(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitUnaryOp(this); + else return visitor.visitChildren(this); + } + } + + public final UnaryOpContext unaryOp() throws RecognitionException { + UnaryOpContext _localctx = new UnaryOpContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_unaryOp); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(229); + _la = _input.LA(1); + if ( !(_la==SUB || _la==NOT) ) { + _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 FieldIdContext extends ParserRuleContext { public IdContext id() { return getRuleContext(IdContext.class,0); } - public ArgsContext args() { - return getRuleContext(ArgsContext.class,0); + public TerminalNode THIS() { return getToken(DecafParser.THIS, 0); } + public List recipient() { + return getRuleContexts(RecipientContext.class); + } + public RecipientContext recipient(int i) { + return getRuleContext(RecipientContext.class,i); + } + public FieldIdContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_fieldId; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterFieldId(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitFieldId(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitFieldId(this); + else return visitor.visitChildren(this); + } + } + + public final FieldIdContext fieldId() throws RecognitionException { + FieldIdContext _localctx = new FieldIdContext(_ctx, getState()); + enterRule(_localctx, 36, RULE_fieldId); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(233); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==THIS) { + { + setState(231); + match(THIS); + setState(232); + match(T__18); + } + } + + setState(240); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(235); + recipient(); + setState(236); + match(T__18); + } + } + } + setState(242); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); + } + setState(243); + id(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethCallContext extends ParserRuleContext { + public MethNameContext methName() { + return getRuleContext(MethNameContext.class,0); + } + public TerminalNode THIS() { return getToken(DecafParser.THIS, 0); } + public List recipient() { + return getRuleContexts(RecipientContext.class); + } + public RecipientContext recipient(int i) { + return getRuleContext(RecipientContext.class,i); } public MethCallContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); @@ -1667,27 +2027,168 @@ public class DecafParser extends Parser { public final MethCallContext methCall() throws RecognitionException { MethCallContext _localctx = new MethCallContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_methCall); + enterRule(_localctx, 38, RULE_methCall); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(247); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==THIS) { + { + setState(245); + match(THIS); + setState(246); + match(T__18); + } + } + + setState(254); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,21,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(249); + recipient(); + setState(250); + match(T__18); + } + } + } + setState(256); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,21,_ctx); + } + setState(257); + methName(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecipientContext extends ParserRuleContext { + public MethNameContext methName() { + return getRuleContext(MethNameContext.class,0); + } + public IdContext id() { + return getRuleContext(IdContext.class,0); + } + public RecipientContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recipient; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterRecipient(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitRecipient(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitRecipient(this); + else return visitor.visitChildren(this); + } + } + + public final RecipientContext recipient() throws RecognitionException { + RecipientContext _localctx = new RecipientContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_recipient); + try { + setState(261); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(259); + methName(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(260); + id(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethNameContext extends ParserRuleContext { + public IdContext id() { + return getRuleContext(IdContext.class,0); + } + public ArgsContext args() { + return getRuleContext(ArgsContext.class,0); + } + public MethNameContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methName; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).enterMethName(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof DecafListener ) ((DecafListener)listener).exitMethName(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitMethName(this); + else return visitor.visitChildren(this); + } + } + + public final MethNameContext methName() throws RecognitionException { + MethNameContext _localctx = new MethNameContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_methName); int _la; try { enterOuterAlt(_localctx, 1); { - setState(206); + setState(263); id(); - setState(207); - match(T__5); - setState(209); + setState(264); + match(T__4); + setState(266); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7527727168L) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 264432577937440L) != 0)) { { - setState(208); + setState(265); args(); } } - setState(211); - match(T__6); + setState(268); + match(T__5); } } catch (RecognitionException re) { @@ -1730,26 +2231,26 @@ public class DecafParser extends Parser { public final ArgsContext args() throws RecognitionException { ArgsContext _localctx = new ArgsContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_args); + enterRule(_localctx, 44, RULE_args); int _la; try { enterOuterAlt(_localctx, 1); { - setState(213); + setState(270); expr(0); - setState(218); + setState(275); _errHandler.sync(this); _la = _input.LA(1); - while (_la==T__10) { + while (_la==T__9) { { { - setState(214); - match(T__10); - setState(215); + setState(271); + match(T__9); + setState(272); expr(0); } } - setState(220); + setState(277); _errHandler.sync(this); _la = _input.LA(1); } @@ -1769,10 +2270,8 @@ public class DecafParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class LiteralContext extends ParserRuleContext { public TerminalNode NUMBER() { return getToken(DecafParser.NUMBER, 0); } - public BooleanContext boolean_() { - return getRuleContext(BooleanContext.class,0); - } - public TerminalNode CHAR() { return getToken(DecafParser.CHAR, 0); } + public TerminalNode BOOLEANLITERAL() { return getToken(DecafParser.BOOLEANLITERAL, 0); } + public TerminalNode CHARLITERAL() { return getToken(DecafParser.CHARLITERAL, 0); } public LiteralContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @@ -1794,79 +2293,14 @@ public class DecafParser extends Parser { public final LiteralContext literal() throws RecognitionException { LiteralContext _localctx = new LiteralContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_literal); - try { - setState(224); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NUMBER: - enterOuterAlt(_localctx, 1); - { - setState(221); - match(NUMBER); - } - break; - case T__19: - case T__20: - enterOuterAlt(_localctx, 2); - { - setState(222); - boolean_(); - } - break; - case CHAR: - enterOuterAlt(_localctx, 3); - { - setState(223); - match(CHAR); - } - 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 BooleanContext extends ParserRuleContext { - public BooleanContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).enterBoolean(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof DecafListener ) ((DecafListener)listener).exitBoolean(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof DecafVisitor ) return ((DecafVisitor)visitor).visitBoolean(this); - else return visitor.visitChildren(this); - } - } - - public final BooleanContext boolean_() throws RecognitionException { - BooleanContext _localctx = new BooleanContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_boolean); + enterRule(_localctx, 46, RULE_literal); int _la; try { enterOuterAlt(_localctx, 1); { - setState(226); + setState(278); _la = _input.LA(1); - if ( !(_la==T__19 || _la==T__20) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 193514046488576L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -1911,11 +2345,11 @@ public class DecafParser extends Parser { public final IdContext id() throws RecognitionException { IdContext _localctx = new IdContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_id); + enterRule(_localctx, 48, RULE_id); try { enterOuterAlt(_localctx, 1); { - setState(228); + setState(280); match(IDENTIFIER); } } @@ -1932,7 +2366,7 @@ public class DecafParser extends Parser { public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 12: + case 15: return expr_sempred((ExprContext)_localctx, predIndex); } return true; @@ -1940,154 +2374,189 @@ public class DecafParser extends Parser { private boolean expr_sempred(ExprContext _localctx, int predIndex) { switch (predIndex) { case 0: - return precpred(_ctx, 6); + return precpred(_ctx, 7); } return true; } public static final String _serializedATN = - "\u0004\u0001!\u00e7\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0004\u00010\u011b\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\u0003"+ - "\u0001-\b\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ - "\u0001\u0005\u00014\b\u0001\n\u0001\f\u00017\t\u0001\u0001\u0001\u0001"+ - "\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001"+ - "\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0003\u0002E\b"+ - "\u0002\u0001\u0003\u0001\u0003\u0003\u0003I\b\u0003\u0001\u0004\u0001"+ - "\u0004\u0001\u0005\u0003\u0005N\b\u0005\u0001\u0005\u0001\u0005\u0001"+ - "\u0005\u0001\u0005\u0003\u0005T\b\u0005\u0001\u0005\u0001\u0005\u0001"+ - "\u0005\u0001\u0005\u0003\u0005Z\b\u0005\u0001\u0006\u0001\u0006\u0001"+ - "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ - "\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0005\u0007h\b\u0007\n\u0007"+ - "\f\u0007k\t\u0007\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0005"+ - "\ts\b\t\n\t\f\tv\t\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0003\n\u0081\b\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0003\n\u00a5\b\n\u0001\u000b\u0001\u000b\u0001\u000b"+ - "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+ - "\u0001\u000b\u0001\u000b\u0001\u000b\u0003\u000b\u00b3\b\u000b\u0001\u000b"+ - "\u0001\u000b\u0003\u000b\u00b7\b\u000b\u0001\f\u0001\f\u0001\f\u0001\f"+ - "\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0003\f\u00c2\b\f\u0001\f\u0001"+ - "\f\u0001\f\u0001\f\u0005\f\u00c8\b\f\n\f\f\f\u00cb\t\f\u0001\r\u0001\r"+ - "\u0001\u000e\u0001\u000e\u0001\u000e\u0003\u000e\u00d2\b\u000e\u0001\u000e"+ - "\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0005\u000f\u00d9\b\u000f"+ - "\n\u000f\f\u000f\u00dc\t\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0003"+ - "\u0010\u00e1\b\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001"+ - "\u0012\u0000\u0001\u0018\u0013\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010"+ - "\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$\u0000\u0003\u0002\u0000"+ - "\u001b\u001c\u001e\u001e\u0001\u0000\u0018\u001a\u0001\u0000\u0014\u0015"+ - "\u00f4\u0000\'\u0001\u0000\u0000\u0000\u0002,\u0001\u0000\u0000\u0000"+ - "\u0004D\u0001\u0000\u0000\u0000\u0006H\u0001\u0000\u0000\u0000\bJ\u0001"+ - "\u0000\u0000\u0000\nY\u0001\u0000\u0000\u0000\f[\u0001\u0000\u0000\u0000"+ - "\u000ed\u0001\u0000\u0000\u0000\u0010l\u0001\u0000\u0000\u0000\u0012o"+ - "\u0001\u0000\u0000\u0000\u0014\u00a4\u0001\u0000\u0000\u0000\u0016\u00b6"+ - "\u0001\u0000\u0000\u0000\u0018\u00c1\u0001\u0000\u0000\u0000\u001a\u00cc"+ - "\u0001\u0000\u0000\u0000\u001c\u00ce\u0001\u0000\u0000\u0000\u001e\u00d5"+ - "\u0001\u0000\u0000\u0000 \u00e0\u0001\u0000\u0000\u0000\"\u00e2\u0001"+ - "\u0000\u0000\u0000$\u00e4\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\u0016\u0000\u0000,+\u0001\u0000\u0000\u0000,-\u0001\u0000\u0000"+ - "\u0000-.\u0001\u0000\u0000\u0000./\u0005\u0001\u0000\u0000/0\u0003$\u0012"+ - "\u000005\u0005\u0002\u0000\u000014\u0003\u0004\u0002\u000024\u0003\n\u0005"+ - "\u000031\u0001\u0000\u0000\u000032\u0001\u0000\u0000\u000047\u0001\u0000"+ - "\u0000\u000053\u0001\u0000\u0000\u000056\u0001\u0000\u0000\u000068\u0001"+ - "\u0000\u0000\u000075\u0001\u0000\u0000\u000089\u0005\u0003\u0000\u0000"+ - "9\u0003\u0001\u0000\u0000\u0000:;\u0003\b\u0004\u0000;<\u0003$\u0012\u0000"+ - "<=\u0005\u0004\u0000\u0000=E\u0001\u0000\u0000\u0000>?\u0003\b\u0004\u0000"+ - "?@\u0003$\u0012\u0000@A\u0005\u0005\u0000\u0000AB\u0003\u0018\f\u0000"+ - "BC\u0005\u0004\u0000\u0000CE\u0001\u0000\u0000\u0000D:\u0001\u0000\u0000"+ - "\u0000D>\u0001\u0000\u0000\u0000E\u0005\u0001\u0000\u0000\u0000FI\u0003"+ - "\b\u0004\u0000GI\u0005\u001d\u0000\u0000HF\u0001\u0000\u0000\u0000HG\u0001"+ - "\u0000\u0000\u0000I\u0007\u0001\u0000\u0000\u0000JK\u0007\u0000\u0000"+ - "\u0000K\t\u0001\u0000\u0000\u0000LN\u0005\u0016\u0000\u0000ML\u0001\u0000"+ - "\u0000\u0000MN\u0001\u0000\u0000\u0000NO\u0001\u0000\u0000\u0000OP\u0003"+ - "\u0006\u0003\u0000PQ\u0003$\u0012\u0000QS\u0005\u0006\u0000\u0000RT\u0003"+ - "\u000e\u0007\u0000SR\u0001\u0000\u0000\u0000ST\u0001\u0000\u0000\u0000"+ - "TU\u0001\u0000\u0000\u0000UV\u0005\u0007\u0000\u0000VW\u0003\u0012\t\u0000"+ - "WZ\u0001\u0000\u0000\u0000XZ\u0003\f\u0006\u0000YM\u0001\u0000\u0000\u0000"+ - "YX\u0001\u0000\u0000\u0000Z\u000b\u0001\u0000\u0000\u0000[\\\u0005\u0016"+ - "\u0000\u0000\\]\u0005\b\u0000\u0000]^\u0005\u001d\u0000\u0000^_\u0005"+ - "\t\u0000\u0000_`\u0005\u0006\u0000\u0000`a\u0005\n\u0000\u0000ab\u0005"+ - "\u0007\u0000\u0000bc\u0003\u0012\t\u0000c\r\u0001\u0000\u0000\u0000di"+ - "\u0003\u0010\b\u0000ef\u0005\u000b\u0000\u0000fh\u0003\u0010\b\u0000g"+ - "e\u0001\u0000\u0000\u0000hk\u0001\u0000\u0000\u0000ig\u0001\u0000\u0000"+ - "\u0000ij\u0001\u0000\u0000\u0000j\u000f\u0001\u0000\u0000\u0000ki\u0001"+ - "\u0000\u0000\u0000lm\u0003\b\u0004\u0000mn\u0003$\u0012\u0000n\u0011\u0001"+ - "\u0000\u0000\u0000ot\u0005\u0002\u0000\u0000ps\u0003\u0004\u0002\u0000"+ - "qs\u0003\u0014\n\u0000rp\u0001\u0000\u0000\u0000rq\u0001\u0000\u0000\u0000"+ - "sv\u0001\u0000\u0000\u0000tr\u0001\u0000\u0000\u0000tu\u0001\u0000\u0000"+ - "\u0000uw\u0001\u0000\u0000\u0000vt\u0001\u0000\u0000\u0000wx\u0005\u0003"+ - "\u0000\u0000x\u0013\u0001\u0000\u0000\u0000yz\u0005\f\u0000\u0000z{\u0005"+ - "\u0006\u0000\u0000{|\u0003\u0018\f\u0000|}\u0005\u0007\u0000\u0000}\u0080"+ - "\u0003\u0012\t\u0000~\u007f\u0005\r\u0000\u0000\u007f\u0081\u0003\u0012"+ - "\t\u0000\u0080~\u0001\u0000\u0000\u0000\u0080\u0081\u0001\u0000\u0000"+ - "\u0000\u0081\u00a5\u0001\u0000\u0000\u0000\u0082\u0083\u0005\u000e\u0000"+ - "\u0000\u0083\u0084\u0005\u0006\u0000\u0000\u0084\u0085\u0003\u0018\f\u0000"+ - "\u0085\u0086\u0005\u0004\u0000\u0000\u0086\u0087\u0003\u0018\f\u0000\u0087"+ - "\u0088\u0005\u0004\u0000\u0000\u0088\u0089\u0003\u0018\f\u0000\u0089\u008a"+ - "\u0005\u0007\u0000\u0000\u008a\u008b\u0003\u0012\t\u0000\u008b\u00a5\u0001"+ - "\u0000\u0000\u0000\u008c\u008d\u0005\u000f\u0000\u0000\u008d\u008e\u0005"+ - "\u0006\u0000\u0000\u008e\u008f\u0003\u0018\f\u0000\u008f\u0090\u0005\u0007"+ - "\u0000\u0000\u0090\u0091\u0003\u0012\t\u0000\u0091\u00a5\u0001\u0000\u0000"+ - "\u0000\u0092\u0093\u0005\u0010\u0000\u0000\u0093\u0094\u0003\u0012\t\u0000"+ - "\u0094\u0095\u0005\u000f\u0000\u0000\u0095\u0096\u0005\u0006\u0000\u0000"+ - "\u0096\u0097\u0003\u0018\f\u0000\u0097\u0098\u0005\u0007\u0000\u0000\u0098"+ - "\u00a5\u0001\u0000\u0000\u0000\u0099\u009a\u0005\u0011\u0000\u0000\u009a"+ - "\u009b\u0003\u0018\f\u0000\u009b\u009c\u0005\u0004\u0000\u0000\u009c\u00a5"+ - "\u0001\u0000\u0000\u0000\u009d\u009e\u0005\u0011\u0000\u0000\u009e\u00a5"+ - "\u0005\u0004\u0000\u0000\u009f\u00a0\u0005\u0012\u0000\u0000\u00a0\u00a5"+ - "\u0005\u0004\u0000\u0000\u00a1\u00a2\u0005\u0013\u0000\u0000\u00a2\u00a5"+ - "\u0005\u0004\u0000\u0000\u00a3\u00a5\u0003\u0016\u000b\u0000\u00a4y\u0001"+ - "\u0000\u0000\u0000\u00a4\u0082\u0001\u0000\u0000\u0000\u00a4\u008c\u0001"+ - "\u0000\u0000\u0000\u00a4\u0092\u0001\u0000\u0000\u0000\u00a4\u0099\u0001"+ - "\u0000\u0000\u0000\u00a4\u009d\u0001\u0000\u0000\u0000\u00a4\u009f\u0001"+ - "\u0000\u0000\u0000\u00a4\u00a1\u0001\u0000\u0000\u0000\u00a4\u00a3\u0001"+ - "\u0000\u0000\u0000\u00a5\u0015\u0001\u0000\u0000\u0000\u00a6\u00a7\u0003"+ - "$\u0012\u0000\u00a7\u00a8\u0005\u0005\u0000\u0000\u00a8\u00a9\u0003\u0018"+ - "\f\u0000\u00a9\u00aa\u0005\u0004\u0000\u0000\u00aa\u00b7\u0001\u0000\u0000"+ - "\u0000\u00ab\u00ac\u0003\u001c\u000e\u0000\u00ac\u00ad\u0005\u0004\u0000"+ - "\u0000\u00ad\u00b7\u0001\u0000\u0000\u0000\u00ae\u00af\u0005\u0017\u0000"+ - "\u0000\u00af\u00b0\u0003\b\u0004\u0000\u00b0\u00b2\u0005\u0006\u0000\u0000"+ - "\u00b1\u00b3\u0003\u001e\u000f\u0000\u00b2\u00b1\u0001\u0000\u0000\u0000"+ - "\u00b2\u00b3\u0001\u0000\u0000\u0000\u00b3\u00b4\u0001\u0000\u0000\u0000"+ - "\u00b4\u00b5\u0005\u0007\u0000\u0000\u00b5\u00b7\u0001\u0000\u0000\u0000"+ - "\u00b6\u00a6\u0001\u0000\u0000\u0000\u00b6\u00ab\u0001\u0000\u0000\u0000"+ - "\u00b6\u00ae\u0001\u0000\u0000\u0000\u00b7\u0017\u0001\u0000\u0000\u0000"+ - "\u00b8\u00b9\u0006\f\uffff\uffff\u0000\u00b9\u00c2\u0003 \u0010\u0000"+ - "\u00ba\u00bb\u0005\u0006\u0000\u0000\u00bb\u00bc\u0003\u0018\f\u0000\u00bc"+ - "\u00bd\u0005\u0007\u0000\u0000\u00bd\u00c2\u0001\u0000\u0000\u0000\u00be"+ - "\u00c2\u0003\u001c\u000e\u0000\u00bf\u00c2\u0003$\u0012\u0000\u00c0\u00c2"+ - "\u0003\u0016\u000b\u0000\u00c1\u00b8\u0001\u0000\u0000\u0000\u00c1\u00ba"+ - "\u0001\u0000\u0000\u0000\u00c1\u00be\u0001\u0000\u0000\u0000\u00c1\u00bf"+ - "\u0001\u0000\u0000\u0000\u00c1\u00c0\u0001\u0000\u0000\u0000\u00c2\u00c9"+ - "\u0001\u0000\u0000\u0000\u00c3\u00c4\n\u0006\u0000\u0000\u00c4\u00c5\u0003"+ - "\u001a\r\u0000\u00c5\u00c6\u0003\u0018\f\u0007\u00c6\u00c8\u0001\u0000"+ - "\u0000\u0000\u00c7\u00c3\u0001\u0000\u0000\u0000\u00c8\u00cb\u0001\u0000"+ - "\u0000\u0000\u00c9\u00c7\u0001\u0000\u0000\u0000\u00c9\u00ca\u0001\u0000"+ - "\u0000\u0000\u00ca\u0019\u0001\u0000\u0000\u0000\u00cb\u00c9\u0001\u0000"+ - "\u0000\u0000\u00cc\u00cd\u0007\u0001\u0000\u0000\u00cd\u001b\u0001\u0000"+ - "\u0000\u0000\u00ce\u00cf\u0003$\u0012\u0000\u00cf\u00d1\u0005\u0006\u0000"+ - "\u0000\u00d0\u00d2\u0003\u001e\u000f\u0000\u00d1\u00d0\u0001\u0000\u0000"+ - "\u0000\u00d1\u00d2\u0001\u0000\u0000\u0000\u00d2\u00d3\u0001\u0000\u0000"+ - "\u0000\u00d3\u00d4\u0005\u0007\u0000\u0000\u00d4\u001d\u0001\u0000\u0000"+ - "\u0000\u00d5\u00da\u0003\u0018\f\u0000\u00d6\u00d7\u0005\u000b\u0000\u0000"+ - "\u00d7\u00d9\u0003\u0018\f\u0000\u00d8\u00d6\u0001\u0000\u0000\u0000\u00d9"+ - "\u00dc\u0001\u0000\u0000\u0000\u00da\u00d8\u0001\u0000\u0000\u0000\u00da"+ - "\u00db\u0001\u0000\u0000\u0000\u00db\u001f\u0001\u0000\u0000\u0000\u00dc"+ - "\u00da\u0001\u0000\u0000\u0000\u00dd\u00e1\u0005 \u0000\u0000\u00de\u00e1"+ - "\u0003\"\u0011\u0000\u00df\u00e1\u0005\u001e\u0000\u0000\u00e0\u00dd\u0001"+ - "\u0000\u0000\u0000\u00e0\u00de\u0001\u0000\u0000\u0000\u00e0\u00df\u0001"+ - "\u0000\u0000\u0000\u00e1!\u0001\u0000\u0000\u0000\u00e2\u00e3\u0007\u0002"+ - "\u0000\u0000\u00e3#\u0001\u0000\u0000\u0000\u00e4\u00e5\u0005\u001f\u0000"+ - "\u0000\u00e5%\u0001\u0000\u0000\u0000\u0015),35DHMSYirt\u0080\u00a4\u00b2"+ - "\u00b6\u00c1\u00c9\u00d1\u00da\u00e0"; + "\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015"+ + "\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007\u0018"+ + "\u0001\u0000\u0004\u00004\b\u0000\u000b\u0000\f\u00005\u0001\u0001\u0003"+ + "\u00019\b\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0001\u0001\u0001\u0001\u0005\u0001B\b\u0001\n\u0001\f\u0001E\t"+ + "\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001"+ + "\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001"+ + "\u0004\u0001\u0005\u0001\u0005\u0003\u0005U\b\u0005\u0001\u0006\u0001"+ + "\u0006\u0001\u0007\u0003\u0007Z\b\u0007\u0001\u0007\u0001\u0007\u0001"+ + "\u0007\u0001\u0007\u0003\u0007`\b\u0007\u0001\u0007\u0001\u0007\u0001"+ + "\u0007\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\b"+ + "\u0001\b\u0001\t\u0003\to\b\t\u0001\t\u0001\t\u0001\t\u0003\tt\b\t\u0001"+ + "\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0005\n|\b\n\n\n\f\n\u007f"+ + "\t\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0005"+ + "\f\u0087\b\f\n\f\f\f\u008a\t\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r"+ + "\u0001\r\u0001\r\u0001\r\u0001\r\u0003\r\u0095\b\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0003\r\u00c0\b\r\u0001\u000e\u0001\u000e\u0001\u000e"+ + "\u0001\u000e\u0001\u000e\u0003\u000e\u00c7\b\u000e\u0001\u000e\u0001\u000e"+ + "\u0003\u000e\u00cb\b\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ + "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ + "\u0001\u000f\u0001\u000f\u0003\u000f\u00d9\b\u000f\u0001\u000f\u0001\u000f"+ + "\u0001\u000f\u0001\u000f\u0005\u000f\u00df\b\u000f\n\u000f\f\u000f\u00e2"+ + "\t\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+ + "\u0012\u0003\u0012\u00ea\b\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0005"+ + "\u0012\u00ef\b\u0012\n\u0012\f\u0012\u00f2\t\u0012\u0001\u0012\u0001\u0012"+ + "\u0001\u0013\u0001\u0013\u0003\u0013\u00f8\b\u0013\u0001\u0013\u0001\u0013"+ + "\u0001\u0013\u0005\u0013\u00fd\b\u0013\n\u0013\f\u0013\u0100\t\u0013\u0001"+ + "\u0013\u0001\u0013\u0001\u0014\u0001\u0014\u0003\u0014\u0106\b\u0014\u0001"+ + "\u0015\u0001\u0015\u0001\u0015\u0003\u0015\u010b\b\u0015\u0001\u0015\u0001"+ + "\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0005\u0016\u0112\b\u0016\n"+ + "\u0016\f\u0016\u0115\t\u0016\u0001\u0017\u0001\u0017\u0001\u0018\u0001"+ + "\u0018\u0001\u0018\u0000\u0001\u001e\u0019\u0000\u0002\u0004\u0006\b\n"+ + "\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$&(*,.0\u0000"+ + "\u0005\u0001\u0000#&\u0002\u0000()++\u0001\u0000\u0018\"\u0002\u0000\u0018"+ + "\u0018\'\'\u0002\u0000,-//\u0127\u00003\u0001\u0000\u0000\u0000\u0002"+ + "8\u0001\u0000\u0000\u0000\u0004H\u0001\u0000\u0000\u0000\u0006L\u0001"+ + "\u0000\u0000\u0000\bP\u0001\u0000\u0000\u0000\nT\u0001\u0000\u0000\u0000"+ + "\fV\u0001\u0000\u0000\u0000\u000eY\u0001\u0000\u0000\u0000\u0010d\u0001"+ + "\u0000\u0000\u0000\u0012n\u0001\u0000\u0000\u0000\u0014x\u0001\u0000\u0000"+ + "\u0000\u0016\u0080\u0001\u0000\u0000\u0000\u0018\u0083\u0001\u0000\u0000"+ + "\u0000\u001a\u00bf\u0001\u0000\u0000\u0000\u001c\u00ca\u0001\u0000\u0000"+ + "\u0000\u001e\u00d8\u0001\u0000\u0000\u0000 \u00e3\u0001\u0000\u0000\u0000"+ + "\"\u00e5\u0001\u0000\u0000\u0000$\u00e9\u0001\u0000\u0000\u0000&\u00f7"+ + "\u0001\u0000\u0000\u0000(\u0105\u0001\u0000\u0000\u0000*\u0107\u0001\u0000"+ + "\u0000\u0000,\u010e\u0001\u0000\u0000\u0000.\u0116\u0001\u0000\u0000\u0000"+ + "0\u0118\u0001\u0000\u0000\u000024\u0003\u0002\u0001\u000032\u0001\u0000"+ + "\u0000\u000045\u0001\u0000\u0000\u000053\u0001\u0000\u0000\u000056\u0001"+ + "\u0000\u0000\u00006\u0001\u0001\u0000\u0000\u000079\u0005\u0014\u0000"+ + "\u000087\u0001\u0000\u0000\u000089\u0001\u0000\u0000\u00009:\u0001\u0000"+ + "\u0000\u0000:;\u0005\u0001\u0000\u0000;<\u00030\u0018\u0000<=\u0005\u0002"+ + "\u0000\u0000=C\u0003\u0010\b\u0000>B\u0003\u0004\u0002\u0000?B\u0003\u000e"+ + "\u0007\u0000@B\u0003\u0012\t\u0000A>\u0001\u0000\u0000\u0000A?\u0001\u0000"+ + "\u0000\u0000A@\u0001\u0000\u0000\u0000BE\u0001\u0000\u0000\u0000CA\u0001"+ + "\u0000\u0000\u0000CD\u0001\u0000\u0000\u0000DF\u0001\u0000\u0000\u0000"+ + "EC\u0001\u0000\u0000\u0000FG\u0005\u0003\u0000\u0000G\u0003\u0001\u0000"+ + "\u0000\u0000HI\u0003\f\u0006\u0000IJ\u00030\u0018\u0000JK\u0005\u0004"+ + "\u0000\u0000K\u0005\u0001\u0000\u0000\u0000LM\u0003\f\u0006\u0000MN\u0003"+ + "0\u0018\u0000NO\u0005\u0004\u0000\u0000O\u0007\u0001\u0000\u0000\u0000"+ + "PQ\u0007\u0000\u0000\u0000Q\t\u0001\u0000\u0000\u0000RU\u0003\f\u0006"+ + "\u0000SU\u0005*\u0000\u0000TR\u0001\u0000\u0000\u0000TS\u0001\u0000\u0000"+ + "\u0000U\u000b\u0001\u0000\u0000\u0000VW\u0007\u0001\u0000\u0000W\r\u0001"+ + "\u0000\u0000\u0000XZ\u0005\u0014\u0000\u0000YX\u0001\u0000\u0000\u0000"+ + "YZ\u0001\u0000\u0000\u0000Z[\u0001\u0000\u0000\u0000[\\\u0003\n\u0005"+ + "\u0000\\]\u00030\u0018\u0000]_\u0005\u0005\u0000\u0000^`\u0003\u0014\n"+ + "\u0000_^\u0001\u0000\u0000\u0000_`\u0001\u0000\u0000\u0000`a\u0001\u0000"+ + "\u0000\u0000ab\u0005\u0006\u0000\u0000bc\u0003\u0018\f\u0000c\u000f\u0001"+ + "\u0000\u0000\u0000de\u0005\u0014\u0000\u0000ef\u0005\u0007\u0000\u0000"+ + "fg\u0005*\u0000\u0000gh\u0005\b\u0000\u0000hi\u0005\u0005\u0000\u0000"+ + "ij\u0005\t\u0000\u0000jk\u0005\u0006\u0000\u0000kl\u0003\u0018\f\u0000"+ + "l\u0011\u0001\u0000\u0000\u0000mo\u0005\u0014\u0000\u0000nm\u0001\u0000"+ + "\u0000\u0000no\u0001\u0000\u0000\u0000op\u0001\u0000\u0000\u0000pq\u0003"+ + "0\u0018\u0000qs\u0005\u0005\u0000\u0000rt\u0003\u0014\n\u0000sr\u0001"+ + "\u0000\u0000\u0000st\u0001\u0000\u0000\u0000tu\u0001\u0000\u0000\u0000"+ + "uv\u0005\u0006\u0000\u0000vw\u0003\u0018\f\u0000w\u0013\u0001\u0000\u0000"+ + "\u0000x}\u0003\u0016\u000b\u0000yz\u0005\n\u0000\u0000z|\u0003\u0016\u000b"+ + "\u0000{y\u0001\u0000\u0000\u0000|\u007f\u0001\u0000\u0000\u0000}{\u0001"+ + "\u0000\u0000\u0000}~\u0001\u0000\u0000\u0000~\u0015\u0001\u0000\u0000"+ + "\u0000\u007f}\u0001\u0000\u0000\u0000\u0080\u0081\u0003\f\u0006\u0000"+ + "\u0081\u0082\u00030\u0018\u0000\u0082\u0017\u0001\u0000\u0000\u0000\u0083"+ + "\u0088\u0005\u0002\u0000\u0000\u0084\u0087\u0003\u0006\u0003\u0000\u0085"+ + "\u0087\u0003\u001a\r\u0000\u0086\u0084\u0001\u0000\u0000\u0000\u0086\u0085"+ + "\u0001\u0000\u0000\u0000\u0087\u008a\u0001\u0000\u0000\u0000\u0088\u0086"+ + "\u0001\u0000\u0000\u0000\u0088\u0089\u0001\u0000\u0000\u0000\u0089\u008b"+ + "\u0001\u0000\u0000\u0000\u008a\u0088\u0001\u0000\u0000\u0000\u008b\u008c"+ + "\u0005\u0003\u0000\u0000\u008c\u0019\u0001\u0000\u0000\u0000\u008d\u008e"+ + "\u0005\u000b\u0000\u0000\u008e\u008f\u0005\u0005\u0000\u0000\u008f\u0090"+ + "\u0003\u001e\u000f\u0000\u0090\u0091\u0005\u0006\u0000\u0000\u0091\u0094"+ + "\u0003\u0018\f\u0000\u0092\u0093\u0005\f\u0000\u0000\u0093\u0095\u0003"+ + "\u0018\f\u0000\u0094\u0092\u0001\u0000\u0000\u0000\u0094\u0095\u0001\u0000"+ + "\u0000\u0000\u0095\u00c0\u0001\u0000\u0000\u0000\u0096\u0097\u0005\r\u0000"+ + "\u0000\u0097\u0098\u0005\u0005\u0000\u0000\u0098\u0099\u0003\u001e\u000f"+ + "\u0000\u0099\u009a\u0005\u0004\u0000\u0000\u009a\u009b\u0003\u001e\u000f"+ + "\u0000\u009b\u009c\u0005\u0004\u0000\u0000\u009c\u009d\u0003\u001e\u000f"+ + "\u0000\u009d\u009e\u0005\u0006\u0000\u0000\u009e\u009f\u0003\u0018\f\u0000"+ + "\u009f\u00c0\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005\u000e\u0000\u0000"+ + "\u00a1\u00a2\u0005\u0005\u0000\u0000\u00a2\u00a3\u0003\u001e\u000f\u0000"+ + "\u00a3\u00a4\u0005\u0006\u0000\u0000\u00a4\u00a5\u0003\u0018\f\u0000\u00a5"+ + "\u00c0\u0001\u0000\u0000\u0000\u00a6\u00a7\u0005\u000f\u0000\u0000\u00a7"+ + "\u00a8\u0003\u0018\f\u0000\u00a8\u00a9\u0005\u000e\u0000\u0000\u00a9\u00aa"+ + "\u0005\u0005\u0000\u0000\u00aa\u00ab\u0003\u001e\u000f\u0000\u00ab\u00ac"+ + "\u0005\u0006\u0000\u0000\u00ac\u00c0\u0001\u0000\u0000\u0000\u00ad\u00ae"+ + "\u0005\u0010\u0000\u0000\u00ae\u00af\u0003\u001e\u000f\u0000\u00af\u00b0"+ + "\u0005\u0004\u0000\u0000\u00b0\u00c0\u0001\u0000\u0000\u0000\u00b1\u00b2"+ + "\u0005\u0010\u0000\u0000\u00b2\u00c0\u0005\u0004\u0000\u0000\u00b3\u00b4"+ + "\u0005\u0011\u0000\u0000\u00b4\u00c0\u0005\u0004\u0000\u0000\u00b5\u00b6"+ + "\u0005\u0012\u0000\u0000\u00b6\u00c0\u0005\u0004\u0000\u0000\u00b7\u00b8"+ + "\u00030\u0018\u0000\u00b8\u00b9\u0003\b\u0004\u0000\u00b9\u00ba\u0003"+ + "\u001e\u000f\u0000\u00ba\u00bb\u0005\u0004\u0000\u0000\u00bb\u00c0\u0001"+ + "\u0000\u0000\u0000\u00bc\u00bd\u0003\u001c\u000e\u0000\u00bd\u00be\u0005"+ + "\u0004\u0000\u0000\u00be\u00c0\u0001\u0000\u0000\u0000\u00bf\u008d\u0001"+ + "\u0000\u0000\u0000\u00bf\u0096\u0001\u0000\u0000\u0000\u00bf\u00a0\u0001"+ + "\u0000\u0000\u0000\u00bf\u00a6\u0001\u0000\u0000\u0000\u00bf\u00ad\u0001"+ + "\u0000\u0000\u0000\u00bf\u00b1\u0001\u0000\u0000\u0000\u00bf\u00b3\u0001"+ + "\u0000\u0000\u0000\u00bf\u00b5\u0001\u0000\u0000\u0000\u00bf\u00b7\u0001"+ + "\u0000\u0000\u0000\u00bf\u00bc\u0001\u0000\u0000\u0000\u00c0\u001b\u0001"+ + "\u0000\u0000\u0000\u00c1\u00cb\u0003&\u0013\u0000\u00c2\u00c3\u0005\u0015"+ + "\u0000\u0000\u00c3\u00c4\u0003\f\u0006\u0000\u00c4\u00c6\u0005\u0005\u0000"+ + "\u0000\u00c5\u00c7\u0003,\u0016\u0000\u00c6\u00c5\u0001\u0000\u0000\u0000"+ + "\u00c6\u00c7\u0001\u0000\u0000\u0000\u00c7\u00c8\u0001\u0000\u0000\u0000"+ + "\u00c8\u00c9\u0005\u0006\u0000\u0000\u00c9\u00cb\u0001\u0000\u0000\u0000"+ + "\u00ca\u00c1\u0001\u0000\u0000\u0000\u00ca\u00c2\u0001\u0000\u0000\u0000"+ + "\u00cb\u001d\u0001\u0000\u0000\u0000\u00cc\u00cd\u0006\u000f\uffff\uffff"+ + "\u0000\u00cd\u00ce\u0003\"\u0011\u0000\u00ce\u00cf\u0003\u001e\u000f\u0006"+ + "\u00cf\u00d9\u0001\u0000\u0000\u0000\u00d0\u00d9\u0003.\u0017\u0000\u00d1"+ + "\u00d2\u0005\u0005\u0000\u0000\u00d2\u00d3\u0003\u001e\u000f\u0000\u00d3"+ + "\u00d4\u0005\u0006\u0000\u0000\u00d4\u00d9\u0001\u0000\u0000\u0000\u00d5"+ + "\u00d9\u0003$\u0012\u0000\u00d6\u00d9\u0003\u001c\u000e\u0000\u00d7\u00d9"+ + "\u0005\u0016\u0000\u0000\u00d8\u00cc\u0001\u0000\u0000\u0000\u00d8\u00d0"+ + "\u0001\u0000\u0000\u0000\u00d8\u00d1\u0001\u0000\u0000\u0000\u00d8\u00d5"+ + "\u0001\u0000\u0000\u0000\u00d8\u00d6\u0001\u0000\u0000\u0000\u00d8\u00d7"+ + "\u0001\u0000\u0000\u0000\u00d9\u00e0\u0001\u0000\u0000\u0000\u00da\u00db"+ + "\n\u0007\u0000\u0000\u00db\u00dc\u0003 \u0010\u0000\u00dc\u00dd\u0003"+ + "\u001e\u000f\b\u00dd\u00df\u0001\u0000\u0000\u0000\u00de\u00da\u0001\u0000"+ + "\u0000\u0000\u00df\u00e2\u0001\u0000\u0000\u0000\u00e0\u00de\u0001\u0000"+ + "\u0000\u0000\u00e0\u00e1\u0001\u0000\u0000\u0000\u00e1\u001f\u0001\u0000"+ + "\u0000\u0000\u00e2\u00e0\u0001\u0000\u0000\u0000\u00e3\u00e4\u0007\u0002"+ + "\u0000\u0000\u00e4!\u0001\u0000\u0000\u0000\u00e5\u00e6\u0007\u0003\u0000"+ + "\u0000\u00e6#\u0001\u0000\u0000\u0000\u00e7\u00e8\u0005\u0017\u0000\u0000"+ + "\u00e8\u00ea\u0005\u0013\u0000\u0000\u00e9\u00e7\u0001\u0000\u0000\u0000"+ + "\u00e9\u00ea\u0001\u0000\u0000\u0000\u00ea\u00f0\u0001\u0000\u0000\u0000"+ + "\u00eb\u00ec\u0003(\u0014\u0000\u00ec\u00ed\u0005\u0013\u0000\u0000\u00ed"+ + "\u00ef\u0001\u0000\u0000\u0000\u00ee\u00eb\u0001\u0000\u0000\u0000\u00ef"+ + "\u00f2\u0001\u0000\u0000\u0000\u00f0\u00ee\u0001\u0000\u0000\u0000\u00f0"+ + "\u00f1\u0001\u0000\u0000\u0000\u00f1\u00f3\u0001\u0000\u0000\u0000\u00f2"+ + "\u00f0\u0001\u0000\u0000\u0000\u00f3\u00f4\u00030\u0018\u0000\u00f4%\u0001"+ + "\u0000\u0000\u0000\u00f5\u00f6\u0005\u0017\u0000\u0000\u00f6\u00f8\u0005"+ + "\u0013\u0000\u0000\u00f7\u00f5\u0001\u0000\u0000\u0000\u00f7\u00f8\u0001"+ + "\u0000\u0000\u0000\u00f8\u00fe\u0001\u0000\u0000\u0000\u00f9\u00fa\u0003"+ + "(\u0014\u0000\u00fa\u00fb\u0005\u0013\u0000\u0000\u00fb\u00fd\u0001\u0000"+ + "\u0000\u0000\u00fc\u00f9\u0001\u0000\u0000\u0000\u00fd\u0100\u0001\u0000"+ + "\u0000\u0000\u00fe\u00fc\u0001\u0000\u0000\u0000\u00fe\u00ff\u0001\u0000"+ + "\u0000\u0000\u00ff\u0101\u0001\u0000\u0000\u0000\u0100\u00fe\u0001\u0000"+ + "\u0000\u0000\u0101\u0102\u0003*\u0015\u0000\u0102\'\u0001\u0000\u0000"+ + "\u0000\u0103\u0106\u0003*\u0015\u0000\u0104\u0106\u00030\u0018\u0000\u0105"+ + "\u0103\u0001\u0000\u0000\u0000\u0105\u0104\u0001\u0000\u0000\u0000\u0106"+ + ")\u0001\u0000\u0000\u0000\u0107\u0108\u00030\u0018\u0000\u0108\u010a\u0005"+ + "\u0005\u0000\u0000\u0109\u010b\u0003,\u0016\u0000\u010a\u0109\u0001\u0000"+ + "\u0000\u0000\u010a\u010b\u0001\u0000\u0000\u0000\u010b\u010c\u0001\u0000"+ + "\u0000\u0000\u010c\u010d\u0005\u0006\u0000\u0000\u010d+\u0001\u0000\u0000"+ + "\u0000\u010e\u0113\u0003\u001e\u000f\u0000\u010f\u0110\u0005\n\u0000\u0000"+ + "\u0110\u0112\u0003\u001e\u000f\u0000\u0111\u010f\u0001\u0000\u0000\u0000"+ + "\u0112\u0115\u0001\u0000\u0000\u0000\u0113\u0111\u0001\u0000\u0000\u0000"+ + "\u0113\u0114\u0001\u0000\u0000\u0000\u0114-\u0001\u0000\u0000\u0000\u0115"+ + "\u0113\u0001\u0000\u0000\u0000\u0116\u0117\u0007\u0004\u0000\u0000\u0117"+ + "/\u0001\u0000\u0000\u0000\u0118\u0119\u0005.\u0000\u0000\u01191\u0001"+ + "\u0000\u0000\u0000\u001958ACTY_ns}\u0086\u0088\u0094\u00bf\u00c6\u00ca"+ + "\u00d8\u00e0\u00e9\u00f0\u00f7\u00fe\u0105\u010a\u0113"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/de/maishai/antlr/DecafVisitor.java b/src/main/java/de/maishai/antlr/DecafVisitor.java index 2704c63..360ffc5 100644 --- a/src/main/java/de/maishai/antlr/DecafVisitor.java +++ b/src/main/java/de/maishai/antlr/DecafVisitor.java @@ -23,11 +23,23 @@ public interface DecafVisitor extends ParseTreeVisitor { */ T visitClass(DecafParser.ClassContext ctx); /** - * Visit a parse tree produced by {@link DecafParser#var}. + * Visit a parse tree produced by {@link DecafParser#field}. * @param ctx the parse tree * @return the visitor result */ - T visitVar(DecafParser.VarContext ctx); + T visitField(DecafParser.FieldContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#localVar}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitLocalVar(DecafParser.LocalVarContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#assignSign}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssignSign(DecafParser.AssignSignContext ctx); /** * Visit a parse tree produced by {@link DecafParser#returntype}. * @param ctx the parse tree @@ -52,6 +64,12 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitMainmeth(DecafParser.MainmethContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#constructor}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitConstructor(DecafParser.ConstructorContext ctx); /** * Visit a parse tree produced by {@link DecafParser#params}. * @param ctx the parse tree @@ -126,6 +144,13 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitContinue(DecafParser.ContinueContext ctx); + /** + * Visit a parse tree produced by the {@code Assignment} + * labeled alternative in {@link DecafParser#stmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssignment(DecafParser.AssignmentContext ctx); /** * Visit a parse tree produced by the {@code StatementExpressionstmt} * labeled alternative in {@link DecafParser#stmt}. @@ -133,13 +158,6 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx); - /** - * Visit a parse tree produced by the {@code Assign} - * labeled alternative in {@link DecafParser#stmtexpr}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitAssign(DecafParser.AssignContext ctx); /** * Visit a parse tree produced by the {@code MethodCall} * labeled alternative in {@link DecafParser#stmtexpr}. @@ -154,6 +172,20 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitNew(DecafParser.NewContext ctx); + /** + * Visit a parse tree produced by the {@code Null} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNull(DecafParser.NullContext ctx); + /** + * Visit a parse tree produced by the {@code UnaryOperation} + * labeled alternative in {@link DecafParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitUnaryOperation(DecafParser.UnaryOperationContext ctx); /** * Visit a parse tree produced by the {@code Identifier} * labeled alternative in {@link DecafParser#expr}. @@ -161,13 +193,6 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitIdentifier(DecafParser.IdentifierContext ctx); - /** - * Visit a parse tree produced by the {@code MethodCallExpression} - * labeled alternative in {@link DecafParser#expr}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx); /** * Visit a parse tree produced by the {@code Expression} * labeled alternative in {@link DecafParser#expr}. @@ -202,12 +227,36 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitBinaryOp(DecafParser.BinaryOpContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#unaryOp}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitUnaryOp(DecafParser.UnaryOpContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#fieldId}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFieldId(DecafParser.FieldIdContext ctx); /** * Visit a parse tree produced by {@link DecafParser#methCall}. * @param ctx the parse tree * @return the visitor result */ T visitMethCall(DecafParser.MethCallContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#recipient}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRecipient(DecafParser.RecipientContext ctx); + /** + * Visit a parse tree produced by {@link DecafParser#methName}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitMethName(DecafParser.MethNameContext ctx); /** * Visit a parse tree produced by {@link DecafParser#args}. * @param ctx the parse tree @@ -220,12 +269,6 @@ public interface DecafVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitLiteral(DecafParser.LiteralContext ctx); - /** - * Visit a parse tree produced by {@link DecafParser#boolean}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitBoolean(DecafParser.BooleanContext ctx); /** * Visit a parse tree produced by {@link DecafParser#id}. * @param ctx the parse tree diff --git a/src/main/java/de/maishai/ast/records/Class.java b/src/main/java/de/maishai/ast/records/Class.java index 87d106c..8173558 100644 --- a/src/main/java/de/maishai/ast/records/Class.java +++ b/src/main/java/de/maishai/ast/records/Class.java @@ -2,5 +2,5 @@ package de.maishai.ast.records; import java.util.List; -public record Class(Id id , List fields, List methods) implements Node { +public record Class(Boolean isPublic, Id id , List fields, List methods, MainMethod mainMethod, List constructors) implements Node { } diff --git a/src/main/java/de/maishai/ast/records/Constructor.java b/src/main/java/de/maishai/ast/records/Constructor.java index d2c3245..d316b4a 100644 --- a/src/main/java/de/maishai/ast/records/Constructor.java +++ b/src/main/java/de/maishai/ast/records/Constructor.java @@ -2,5 +2,5 @@ package de.maishai.ast.records; import java.util.List; -public record Constructor(Id id, List params, Block block) implements Node { +public record Constructor(Boolean isPublic, Id id, List params, Block block) implements Node { } diff --git a/src/main/java/de/maishai/ast/records/Expression.java b/src/main/java/de/maishai/ast/records/Expression.java index 7cd0f75..0a85a76 100644 --- a/src/main/java/de/maishai/ast/records/Expression.java +++ b/src/main/java/de/maishai/ast/records/Expression.java @@ -1,5 +1,5 @@ package de.maishai.ast.records; -public sealed interface Expression extends Node permits Binary, BoolLiteral, CharLiteral, Id, IntLiteral, MethodCall, New, Unary { +public sealed interface Expression extends Node permits Binary, BoolLiteral, CharLiteral, FieldId, Id, IntLiteral, MethodCall, New, Unary { } diff --git a/src/main/java/de/maishai/ast/records/FieldId.java b/src/main/java/de/maishai/ast/records/FieldId.java index 61cb35a..96772fa 100644 --- a/src/main/java/de/maishai/ast/records/FieldId.java +++ b/src/main/java/de/maishai/ast/records/FieldId.java @@ -1,4 +1,4 @@ package de.maishai.ast.records; -public record FieldId(Boolean field, Expression recipient, Id id) implements Node { +public record FieldId(Boolean field, Expression recipient, Id id) implements Expression { } diff --git a/src/main/java/de/maishai/ast/records/Method.java b/src/main/java/de/maishai/ast/records/Method.java index a11e9bc..43c7f48 100644 --- a/src/main/java/de/maishai/ast/records/Method.java +++ b/src/main/java/de/maishai/ast/records/Method.java @@ -6,5 +6,5 @@ import de.maishai.ast.ReturnType; import java.util.List; -public record Method(ReturnType type, Id id, List params, Block block) implements Node { +public record Method(Boolean isPublic, ReturnType type, Id id, List params, Block block) implements Node { } diff --git a/src/main/java/de/maishai/ast/records/Node.java b/src/main/java/de/maishai/ast/records/Node.java index 0560d1d..064f889 100644 --- a/src/main/java/de/maishai/ast/records/Node.java +++ b/src/main/java/de/maishai/ast/records/Node.java @@ -1,4 +1,4 @@ package de.maishai.ast.records; -public sealed interface Node permits Block, Class, Constructor, Expression, Field, FieldId, LocalVariable, MainMethod, Method, Parameter, Program, Statement { +public sealed interface Node permits Block, Class, Constructor, Expression, Field, LocalVariable, MainMethod, Method, Parameter, Program, Statement { }