The default implementation does nothing.
+ */ + @Override public void enterProgram(DecafParser.ProgramContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitProgram(DecafParser.ProgramContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterVar(DecafParser.VarContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitVar(DecafParser.VarContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterType(DecafParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitType(DecafParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterFunc(DecafParser.FuncContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitFunc(DecafParser.FuncContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterParams(DecafParser.ParamsContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitParams(DecafParser.ParamsContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterParam(DecafParser.ParamContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitParam(DecafParser.ParamContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterBlock(DecafParser.BlockContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitBlock(DecafParser.BlockContext 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} + * + *The default implementation does nothing.
+ */ + @Override public void enterFunctionCall(DecafParser.FunctionCallContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitFunctionCall(DecafParser.FunctionCallContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterIf(DecafParser.IfContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitIf(DecafParser.IfContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterWhile(DecafParser.WhileContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitWhile(DecafParser.WhileContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterReturn(DecafParser.ReturnContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitReturn(DecafParser.ReturnContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterReturnVoid(DecafParser.ReturnVoidContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitReturnVoid(DecafParser.ReturnVoidContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterBreak(DecafParser.BreakContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitBreak(DecafParser.BreakContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterContinue(DecafParser.ContinueContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitContinue(DecafParser.ContinueContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterExpression(DecafParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitExpression(DecafParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterFunCallExpression(DecafParser.FunCallExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitFunCallExpression(DecafParser.FunCallExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterConstant(DecafParser.ConstantContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitConstant(DecafParser.ConstantContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterBinaryOperation(DecafParser.BinaryOperationContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitBinaryOperation(DecafParser.BinaryOperationContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterLocation(DecafParser.LocationContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitLocation(DecafParser.LocationContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterBinaryOp(DecafParser.BinaryOpContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitBinaryOp(DecafParser.BinaryOpContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterLoc(DecafParser.LocContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitLoc(DecafParser.LocContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterFuncCall(DecafParser.FuncCallContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitFuncCall(DecafParser.FuncCallContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterArgs(DecafParser.ArgsContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitArgs(DecafParser.ArgsContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterLiteral(DecafParser.LiteralContext ctx) { } + /** + * {@inheritDoc} + * + *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} + * + *The default implementation does nothing.
+ */ + @Override public void enterNumber(DecafParser.NumberContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitNumber(DecafParser.NumberContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterId(DecafParser.IdContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitId(DecafParser.IdContext ctx) { } + + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *The default implementation does nothing.
+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/src/main/java/de/dhbw/horb/antlr/DecafBaseVisitor.java b/src/main/java/de/dhbw/horb/antlr/DecafBaseVisitor.java new file mode 100644 index 0000000..daf1428 --- /dev/null +++ b/src/main/java/de/dhbw/horb/antlr/DecafBaseVisitor.java @@ -0,0 +1,211 @@ +// Generated from /home/simon/dev/AntlrAssignment3Template/src/main/antlr4/de/dhbw/horb/Decaf.g4 by ANTLR 4.13.1 +package de.dhbw.horb.antlr; +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link DecafVisitor}, + * which can be extended to create a visitor which only needs to handle a subset + * of the available methods. + * + * @paramThe default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitProgram(DecafParser.ProgramContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitVar(DecafParser.VarContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitType(DecafParser.TypeContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitFunc(DecafParser.FuncContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitParams(DecafParser.ParamsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitParam(DecafParser.ParamContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitBlock(DecafParser.BlockContext 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); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitFunctionCall(DecafParser.FunctionCallContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitIf(DecafParser.IfContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitWhile(DecafParser.WhileContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitReturn(DecafParser.ReturnContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitReturnVoid(DecafParser.ReturnVoidContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitBreak(DecafParser.BreakContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitContinue(DecafParser.ContinueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitExpression(DecafParser.ExpressionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitFunCallExpression(DecafParser.FunCallExpressionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitConstant(DecafParser.ConstantContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitBinaryOperation(DecafParser.BinaryOperationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitLocation(DecafParser.LocationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@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 visitLoc(DecafParser.LocContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitFuncCall(DecafParser.FuncCallContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitArgs(DecafParser.ArgsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@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} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitNumber(DecafParser.NumberContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.
+ */ + @Override public T visitId(DecafParser.IdContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/src/main/java/de/dhbw/horb/antlr/DecafLexer.interp b/src/main/java/de/dhbw/horb/antlr/DecafLexer.interp new file mode 100644 index 0000000..22f63d0 --- /dev/null +++ b/src/main/java/de/dhbw/horb/antlr/DecafLexer.interp @@ -0,0 +1,92 @@ +token literal names: +null +';' +'def' +'(' +')' +',' +'{' +'}' +'=' +'if' +'else' +'while' +'return' +'break' +'continue' +'true' +'false' +'-' +'+' +'*' +'int' +'bool' +'void' +null +null +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +SUB +ADD +MUL +INT +BOOL +VOID +IDENTIFIER +Number +WS + +rule names: +T__0 +T__1 +T__2 +T__3 +T__4 +T__5 +T__6 +T__7 +T__8 +T__9 +T__10 +T__11 +T__12 +T__13 +T__14 +T__15 +SUB +ADD +MUL +INT +BOOL +VOID +IDENTIFIER +Number +WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 25, 150, 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, 1, 0, 1, 0, 1, 1, 1, 1, 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, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 4, 22, 138, 8, 22, 11, 22, 12, 22, 139, 1, 23, 4, 23, 143, 8, 23, 11, 23, 12, 23, 144, 1, 24, 1, 24, 1, 24, 1, 24, 0, 0, 25, 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, 1, 0, 3, 2, 0, 65, 90, 97, 122, 1, 0, 48, 57, 3, 0, 9, 10, 13, 13, 32, 32, 151, 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, 1, 51, 1, 0, 0, 0, 3, 53, 1, 0, 0, 0, 5, 57, 1, 0, 0, 0, 7, 59, 1, 0, 0, 0, 9, 61, 1, 0, 0, 0, 11, 63, 1, 0, 0, 0, 13, 65, 1, 0, 0, 0, 15, 67, 1, 0, 0, 0, 17, 69, 1, 0, 0, 0, 19, 72, 1, 0, 0, 0, 21, 77, 1, 0, 0, 0, 23, 83, 1, 0, 0, 0, 25, 90, 1, 0, 0, 0, 27, 96, 1, 0, 0, 0, 29, 105, 1, 0, 0, 0, 31, 110, 1, 0, 0, 0, 33, 116, 1, 0, 0, 0, 35, 118, 1, 0, 0, 0, 37, 120, 1, 0, 0, 0, 39, 122, 1, 0, 0, 0, 41, 126, 1, 0, 0, 0, 43, 131, 1, 0, 0, 0, 45, 137, 1, 0, 0, 0, 47, 142, 1, 0, 0, 0, 49, 146, 1, 0, 0, 0, 51, 52, 5, 59, 0, 0, 52, 2, 1, 0, 0, 0, 53, 54, 5, 100, 0, 0, 54, 55, 5, 101, 0, 0, 55, 56, 5, 102, 0, 0, 56, 4, 1, 0, 0, 0, 57, 58, 5, 40, 0, 0, 58, 6, 1, 0, 0, 0, 59, 60, 5, 41, 0, 0, 60, 8, 1, 0, 0, 0, 61, 62, 5, 44, 0, 0, 62, 10, 1, 0, 0, 0, 63, 64, 5, 123, 0, 0, 64, 12, 1, 0, 0, 0, 65, 66, 5, 125, 0, 0, 66, 14, 1, 0, 0, 0, 67, 68, 5, 61, 0, 0, 68, 16, 1, 0, 0, 0, 69, 70, 5, 105, 0, 0, 70, 71, 5, 102, 0, 0, 71, 18, 1, 0, 0, 0, 72, 73, 5, 101, 0, 0, 73, 74, 5, 108, 0, 0, 74, 75, 5, 115, 0, 0, 75, 76, 5, 101, 0, 0, 76, 20, 1, 0, 0, 0, 77, 78, 5, 119, 0, 0, 78, 79, 5, 104, 0, 0, 79, 80, 5, 105, 0, 0, 80, 81, 5, 108, 0, 0, 81, 82, 5, 101, 0, 0, 82, 22, 1, 0, 0, 0, 83, 84, 5, 114, 0, 0, 84, 85, 5, 101, 0, 0, 85, 86, 5, 116, 0, 0, 86, 87, 5, 117, 0, 0, 87, 88, 5, 114, 0, 0, 88, 89, 5, 110, 0, 0, 89, 24, 1, 0, 0, 0, 90, 91, 5, 98, 0, 0, 91, 92, 5, 114, 0, 0, 92, 93, 5, 101, 0, 0, 93, 94, 5, 97, 0, 0, 94, 95, 5, 107, 0, 0, 95, 26, 1, 0, 0, 0, 96, 97, 5, 99, 0, 0, 97, 98, 5, 111, 0, 0, 98, 99, 5, 110, 0, 0, 99, 100, 5, 116, 0, 0, 100, 101, 5, 105, 0, 0, 101, 102, 5, 110, 0, 0, 102, 103, 5, 117, 0, 0, 103, 104, 5, 101, 0, 0, 104, 28, 1, 0, 0, 0, 105, 106, 5, 116, 0, 0, 106, 107, 5, 114, 0, 0, 107, 108, 5, 117, 0, 0, 108, 109, 5, 101, 0, 0, 109, 30, 1, 0, 0, 0, 110, 111, 5, 102, 0, 0, 111, 112, 5, 97, 0, 0, 112, 113, 5, 108, 0, 0, 113, 114, 5, 115, 0, 0, 114, 115, 5, 101, 0, 0, 115, 32, 1, 0, 0, 0, 116, 117, 5, 45, 0, 0, 117, 34, 1, 0, 0, 0, 118, 119, 5, 43, 0, 0, 119, 36, 1, 0, 0, 0, 120, 121, 5, 42, 0, 0, 121, 38, 1, 0, 0, 0, 122, 123, 5, 105, 0, 0, 123, 124, 5, 110, 0, 0, 124, 125, 5, 116, 0, 0, 125, 40, 1, 0, 0, 0, 126, 127, 5, 98, 0, 0, 127, 128, 5, 111, 0, 0, 128, 129, 5, 111, 0, 0, 129, 130, 5, 108, 0, 0, 130, 42, 1, 0, 0, 0, 131, 132, 5, 118, 0, 0, 132, 133, 5, 111, 0, 0, 133, 134, 5, 105, 0, 0, 134, 135, 5, 100, 0, 0, 135, 44, 1, 0, 0, 0, 136, 138, 7, 0, 0, 0, 137, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 46, 1, 0, 0, 0, 141, 143, 7, 1, 0, 0, 142, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 48, 1, 0, 0, 0, 146, 147, 7, 2, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 6, 24, 0, 0, 149, 50, 1, 0, 0, 0, 3, 0, 139, 144, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/main/java/de/dhbw/horb/antlr/DecafLexer.java b/src/main/java/de/dhbw/horb/antlr/DecafLexer.java new file mode 100644 index 0000000..02a84e0 --- /dev/null +++ b/src/main/java/de/dhbw/horb/antlr/DecafLexer.java @@ -0,0 +1,210 @@ +// Generated from /home/simon/dev/AntlrAssignment3Template/src/main/antlr4/de/dhbw/horb/Decaf.g4 by ANTLR 4.13.1 +package de.dhbw.horb.antlr; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) +public class DecafLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + 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, SUB=17, + ADD=18, MUL=19, INT=20, BOOL=21, VOID=22, IDENTIFIER=23, Number=24, WS=25; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + 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", "SUB", + "ADD", "MUL", "INT", "BOOL", "VOID", "IDENTIFIER", "Number", "WS" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "';'", "'def'", "'('", "')'", "','", "'{'", "'}'", "'='", "'if'", + "'else'", "'while'", "'return'", "'break'", "'continue'", "'true'", "'false'", + "'-'", "'+'", "'*'", "'int'", "'bool'", "'void'" + }; + } + 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, "SUB", "ADD", "MUL", "INT", "BOOL", "VOID", + "IDENTIFIER", "Number", "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = "