Generate Antlr and add Generators

This commit is contained in:
Boolean-True 2024-04-30 19:24:49 +02:00
parent deeea62737
commit 12623821f7
16 changed files with 4277 additions and 0 deletions

View File

@ -0,0 +1,74 @@
package de.maishai;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.ReturnType;
import de.maishai.ast.Type;
import de.maishai.ast.records.*;
import de.maishai.ast.records.Class;
import java.util.ArrayList;
import java.util.List;
public class ASTGenerator {
public static Program generateAST(DecafParser.ProgramContext parseTree){
List<Class> classes = new ArrayList<>();
for(DecafParser.ClassContext cctx : parseTree.class_()){
classes.add(generateClass(cctx));
}
return new Program(classes);
}
public static Class generateClass(DecafParser.ClassContext ctx) {
List<Variable> vars = new ArrayList<>();
if(ctx.var() != null){
vars = ctx.var().stream().map(ASTGenerator::generateVariable).toList();
}
List<Method> 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);
}
public static Variable generateVariable(DecafParser.VarContext ctx) {
return new Variable(ctx.id().getText(), getType(ctx.type()));
}
public static Parameter generateParameter(DecafParser.ParamContext ctx) {
return new Parameter(ctx.id().getText(), getType(ctx.type()));
}
public static Method generateMethod(DecafParser.MethContext ctx) {
List<Parameter> 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);
}
public static Type getType(DecafParser.TypeContext ctx){
if(ctx.INT() != null)
return Type.INT;
if(ctx.BOOL() != null)
return Type.BOOL;
if(ctx.CHAR() != null)
return Type.CHAR;
throw new RuntimeException();
}
public static ReturnType getReturnType(DecafParser.ReturntypeContext ctx){
if(ctx.type().INT() != null)
return ReturnType.INT;
if(ctx.type().BOOL() != null)
return ReturnType.BOOL;
if(ctx.type().CHAR() != null)
return ReturnType.CHAR;
if(ctx.VOID() != null)
return ReturnType.VOID;
throw new RuntimeException();
}
}

View File

@ -0,0 +1,18 @@
package de.maishai;
import de.maishai.antlr.DecafBaseVisitor;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.Statement;
import de.maishai.ast.records.Block;
import de.maishai.ast.records.Variable;
import java.util.List;
public class BlockGenerator extends DecafBaseVisitor<Block> {
@Override
public Block visitBlock(DecafParser.BlockContext ctx) {
List<Variable> vars = ctx.var().stream().map(var -> new VariableGenerator().visit(var)).toList();
List<Statement> statements = ctx.stmt().stream().map(stmt -> new StatementGenerator().visit(stmt)).toList();
return new Block(vars, statements);
}
}

View File

@ -0,0 +1,26 @@
package de.maishai;
import de.maishai.antlr.DecafLexer;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.records.Program;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
/**
* Decaf language Compiler
*/
public class Compiler
{
public static Program generateAST(String fromSource){
CharStream input = CharStreams.fromString(fromSource);
DecafLexer lexer = new DecafLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
DecafParser parser = new DecafParser(tokens);
DecafParser.ProgramContext tree = parser.program(); //Parsen
return ASTGenerator.generateAST(tree);
}
}

View File

@ -0,0 +1,65 @@
package de.maishai;
import de.maishai.antlr.DecafBaseVisitor;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.Expression;
import de.maishai.ast.Operator;
import de.maishai.ast.records.Binary;
import de.maishai.ast.records.BoolConstant;
import de.maishai.ast.records.IntConstant;
import de.maishai.ast.records.MethodCall;
import java.util.ArrayList;
import java.util.List;
public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
@Override
public Expression visitBinaryOperation(DecafParser.BinaryOperationContext ctx) {
return generateBinary(ctx);
}
@Override
public Expression visitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) {
String functionName = ctx.methCall().id().getText();
List<Expression> args = new ArrayList<>();
for(var expr : ctx.methCall().args().expr()){
Expression astExpr = expr.accept(this);
args.add(astExpr);
}
return new MethodCall(functionName, args);
}
@Override
public Expression visitConstant(DecafParser.ConstantContext ctx) {
return generateConstant(ctx.literal());
}
@Override
public Expression visitExpression(DecafParser.ExpressionContext ctx) {
//ParseTree for ( expr )
//Just pass it down to the inner expr:
return this.visit(ctx.expr());
}
public static Expression generateConstant(DecafParser.LiteralContext ctx){
if(ctx.NUMBER() != null)
return new IntConstant(Integer.valueOf(ctx.NUMBER().getText()));
if(ctx.boolean_() != null)
return new BoolConstant(Boolean.valueOf(ctx.boolean_().getText()));
throw new RuntimeException();
}
public static Binary generateBinary(DecafParser.BinaryOperationContext ctx){
ExpressionGenerator eGen = new ExpressionGenerator();
return new Binary(eGen.visit(ctx.expr().get(0)) // left side
, generateOperator(ctx.binaryOp()) //operator
, eGen.visit(ctx.expr().get(1))); //right side
}
public static Operator generateOperator(DecafParser.BinaryOpContext ctx){
if(ctx.ADD() != null)return Operator.ADD;
if(ctx.SUB() != null)return Operator.SUB;
if(ctx.MUL() != null)return Operator.MUL;
throw new RuntimeException();
}
}

View File

@ -0,0 +1,55 @@
package de.maishai;
import de.maishai.antlr.DecafBaseVisitor;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.Expression;
import de.maishai.ast.Statement;
import de.maishai.ast.records.*;
public class StatementGenerator extends DecafBaseVisitor<Statement> {
@Override
public Statement visitAssign(DecafParser.AssignContext ctx) {
Id id = new Id(ctx.id().getText());
Expression expr = new ExpressionGenerator().visit(ctx.expr());
return new Assignment(id, expr);
}
@Override
public Statement visitIf(DecafParser.IfContext ctx) {
Expression expr = new ExpressionGenerator().visit(ctx.expr());
Block ifBlock = new BlockGenerator().visit(ctx.block(0));
if(ctx.block().size() == 2){
Block elseBlock = new BlockGenerator().visit(ctx.block(1));
return new IfElse(expr, ifBlock, elseBlock);
}
return new IfElse(expr, ifBlock, null);
}
@Override
public Statement visitWhile(DecafParser.WhileContext ctx) {
Expression expr = new ExpressionGenerator().visit(ctx.expr());
Block block = new BlockGenerator().visit(ctx.block());
return new While(expr, block);
}
@Override
public Statement visitReturn(DecafParser.ReturnContext ctx) {
return new Return(new ExpressionGenerator().visit(ctx.expr()));
}
@Override
public Statement visitReturnVoid(DecafParser.ReturnVoidContext ctx) {
return new ReturnVoid();
}
@Override
public Statement visitBreak(DecafParser.BreakContext ctx) {
return new Break();
}
@Override
public Statement visitContinue(DecafParser.ContinueContext ctx) {
return new Continue();
}
}

View File

@ -0,0 +1,25 @@
package de.maishai;
import de.maishai.antlr.DecafBaseVisitor;
import de.maishai.antlr.DecafParser;
import de.maishai.ast.Type;
import de.maishai.ast.records.Variable;
public class VariableGenerator extends DecafBaseVisitor<Variable> {
@Override
public Variable visitVar(DecafParser.VarContext ctx) {
return new Variable(ctx.id().getText(), getType(ctx.type()));
}
public static Type getType(DecafParser.TypeContext ctx){
if(ctx.INT() != null)
return Type.INT;
if(ctx.BOOL() != null)
return Type.BOOL;
if(ctx.CHAR() != null)
return Type.CHAR;
throw new RuntimeException();
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,62 @@
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
'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
'-'=24
'+'=25
'*'=26
'int'=27
'boolean'=28
'void'=29

View File

@ -0,0 +1,448 @@
// Generated from C:/dev/Compilerbau/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link DecafListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
@SuppressWarnings("CheckReturnValue")
public class DecafBaseListener implements DecafListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterProgram(DecafParser.ProgramContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitProgram(DecafParser.ProgramContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterClass(DecafParser.ClassContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitClass(DecafParser.ClassContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVar(DecafParser.VarContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVar(DecafParser.VarContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterReturntype(DecafParser.ReturntypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitReturntype(DecafParser.ReturntypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterType(DecafParser.TypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitType(DecafParser.TypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMeth(DecafParser.MethContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMeth(DecafParser.MethContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMainmeth(DecafParser.MainmethContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMainmeth(DecafParser.MainmethContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParams(DecafParser.ParamsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParams(DecafParser.ParamsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParam(DecafParser.ParamContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParam(DecafParser.ParamContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBlock(DecafParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBlock(DecafParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIf(DecafParser.IfContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIf(DecafParser.IfContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterFor(DecafParser.ForContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitFor(DecafParser.ForContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterWhile(DecafParser.WhileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitWhile(DecafParser.WhileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDoWhile(DecafParser.DoWhileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDoWhile(DecafParser.DoWhileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterReturn(DecafParser.ReturnContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitReturn(DecafParser.ReturnContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterReturnVoid(DecafParser.ReturnVoidContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitReturnVoid(DecafParser.ReturnVoidContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBreak(DecafParser.BreakContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBreak(DecafParser.BreakContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterContinue(DecafParser.ContinueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitContinue(DecafParser.ContinueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssign(DecafParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssign(DecafParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMethodCall(DecafParser.MethodCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethodCall(DecafParser.MethodCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNew(DecafParser.NewContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNew(DecafParser.NewContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIdentifier(DecafParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIdentifier(DecafParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExpression(DecafParser.ExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExpression(DecafParser.ExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterConstant(DecafParser.ConstantContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitConstant(DecafParser.ConstantContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBinaryOperation(DecafParser.BinaryOperationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBinaryOperation(DecafParser.BinaryOperationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBinaryOp(DecafParser.BinaryOpContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBinaryOp(DecafParser.BinaryOpContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMethCall(DecafParser.MethCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethCall(DecafParser.MethCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterArgs(DecafParser.ArgsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitArgs(DecafParser.ArgsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLiteral(DecafParser.LiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLiteral(DecafParser.LiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBoolean(DecafParser.BooleanContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBoolean(DecafParser.BooleanContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterId(DecafParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitId(DecafParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}

View File

@ -0,0 +1,253 @@
// Generated from C:/dev/Compilerbau/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.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.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
@SuppressWarnings("CheckReturnValue")
public class DecafBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements DecafVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitProgram(DecafParser.ProgramContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitClass(DecafParser.ClassContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVar(DecafParser.VarContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitReturntype(DecafParser.ReturntypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitType(DecafParser.TypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMeth(DecafParser.MethContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMainmeth(DecafParser.MainmethContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParams(DecafParser.ParamsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParam(DecafParser.ParamContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBlock(DecafParser.BlockContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIf(DecafParser.IfContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitFor(DecafParser.ForContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitWhile(DecafParser.WhileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDoWhile(DecafParser.DoWhileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitReturn(DecafParser.ReturnContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitReturnVoid(DecafParser.ReturnVoidContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBreak(DecafParser.BreakContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitContinue(DecafParser.ContinueContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAssign(DecafParser.AssignContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethodCall(DecafParser.MethodCallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNew(DecafParser.NewContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIdentifier(DecafParser.IdentifierContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethodCallExpression(DecafParser.MethodCallExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExpression(DecafParser.ExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitConstant(DecafParser.ConstantContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBinaryOperation(DecafParser.BinaryOperationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBinaryOp(DecafParser.BinaryOpContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethCall(DecafParser.MethCallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitArgs(DecafParser.ArgsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLiteral(DecafParser.LiteralContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBoolean(DecafParser.BooleanContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitId(DecafParser.IdContext ctx) { return visitChildren(ctx); }
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,257 @@
// Generated from C:/dev/Compilerbau/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.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, 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;
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", "T__16",
"T__17", "T__18", "T__19", "T__20", "PUBLIC", "NEW", "SUB", "ADD", "MUL",
"INT", "BOOL", "VOID", "CHAR", "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'"
};
}
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",
"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] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public DecafLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Decaf.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\u0004\u0000!\u00db\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"+
"\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+
"\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+
"\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+
"\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \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"+
"\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"+
"\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"+
"\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";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}

View File

@ -0,0 +1,62 @@
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
'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
'-'=24
'+'=25
'*'=26
'int'=27
'boolean'=28
'void'=29

View File

@ -0,0 +1,386 @@
// Generated from C:/dev/Compilerbau/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
* This interface defines a complete listener for a parse tree produced by
* {@link DecafParser}.
*/
public interface DecafListener extends ParseTreeListener {
/**
* Enter a parse tree produced by {@link DecafParser#program}.
* @param ctx the parse tree
*/
void enterProgram(DecafParser.ProgramContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#program}.
* @param ctx the parse tree
*/
void exitProgram(DecafParser.ProgramContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#class}.
* @param ctx the parse tree
*/
void enterClass(DecafParser.ClassContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#class}.
* @param ctx the parse tree
*/
void exitClass(DecafParser.ClassContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#var}.
* @param ctx the parse tree
*/
void enterVar(DecafParser.VarContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#var}.
* @param ctx the parse tree
*/
void exitVar(DecafParser.VarContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#returntype}.
* @param ctx the parse tree
*/
void enterReturntype(DecafParser.ReturntypeContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#returntype}.
* @param ctx the parse tree
*/
void exitReturntype(DecafParser.ReturntypeContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#type}.
* @param ctx the parse tree
*/
void enterType(DecafParser.TypeContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#type}.
* @param ctx the parse tree
*/
void exitType(DecafParser.TypeContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#meth}.
* @param ctx the parse tree
*/
void enterMeth(DecafParser.MethContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#meth}.
* @param ctx the parse tree
*/
void exitMeth(DecafParser.MethContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#mainmeth}.
* @param ctx the parse tree
*/
void enterMainmeth(DecafParser.MainmethContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#mainmeth}.
* @param ctx the parse tree
*/
void exitMainmeth(DecafParser.MainmethContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#params}.
* @param ctx the parse tree
*/
void enterParams(DecafParser.ParamsContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#params}.
* @param ctx the parse tree
*/
void exitParams(DecafParser.ParamsContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#param}.
* @param ctx the parse tree
*/
void enterParam(DecafParser.ParamContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#param}.
* @param ctx the parse tree
*/
void exitParam(DecafParser.ParamContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#block}.
* @param ctx the parse tree
*/
void enterBlock(DecafParser.BlockContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#block}.
* @param ctx the parse tree
*/
void exitBlock(DecafParser.BlockContext ctx);
/**
* Enter a parse tree produced by the {@code If}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterIf(DecafParser.IfContext ctx);
/**
* Exit a parse tree produced by the {@code If}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitIf(DecafParser.IfContext ctx);
/**
* Enter a parse tree produced by the {@code For}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterFor(DecafParser.ForContext ctx);
/**
* Exit a parse tree produced by the {@code For}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitFor(DecafParser.ForContext ctx);
/**
* Enter a parse tree produced by the {@code While}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterWhile(DecafParser.WhileContext ctx);
/**
* Exit a parse tree produced by the {@code While}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitWhile(DecafParser.WhileContext ctx);
/**
* Enter a parse tree produced by the {@code DoWhile}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterDoWhile(DecafParser.DoWhileContext ctx);
/**
* Exit a parse tree produced by the {@code DoWhile}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitDoWhile(DecafParser.DoWhileContext ctx);
/**
* Enter a parse tree produced by the {@code Return}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterReturn(DecafParser.ReturnContext ctx);
/**
* Exit a parse tree produced by the {@code Return}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitReturn(DecafParser.ReturnContext ctx);
/**
* Enter a parse tree produced by the {@code ReturnVoid}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterReturnVoid(DecafParser.ReturnVoidContext ctx);
/**
* Exit a parse tree produced by the {@code ReturnVoid}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitReturnVoid(DecafParser.ReturnVoidContext ctx);
/**
* Enter a parse tree produced by the {@code Break}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterBreak(DecafParser.BreakContext ctx);
/**
* Exit a parse tree produced by the {@code Break}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitBreak(DecafParser.BreakContext ctx);
/**
* Enter a parse tree produced by the {@code Continue}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterContinue(DecafParser.ContinueContext ctx);
/**
* Exit a parse tree produced by the {@code Continue}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void exitContinue(DecafParser.ContinueContext ctx);
/**
* Enter a parse tree produced by the {@code StatementExpressionstmt}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
*/
void enterStatementExpressionstmt(DecafParser.StatementExpressionstmtContext ctx);
/**
* Exit a parse tree produced by the {@code StatementExpressionstmt}
* labeled alternative in {@link DecafParser#stmt}.
* @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}.
* @param ctx the parse tree
*/
void enterMethodCall(DecafParser.MethodCallContext ctx);
/**
* Exit a parse tree produced by the {@code MethodCall}
* labeled alternative in {@link DecafParser#stmtexpr}.
* @param ctx the parse tree
*/
void exitMethodCall(DecafParser.MethodCallContext ctx);
/**
* Enter a parse tree produced by the {@code New}
* labeled alternative in {@link DecafParser#stmtexpr}.
* @param ctx the parse tree
*/
void enterNew(DecafParser.NewContext ctx);
/**
* Exit a parse tree produced by the {@code New}
* labeled alternative in {@link DecafParser#stmtexpr}.
* @param ctx the parse tree
*/
void exitNew(DecafParser.NewContext ctx);
/**
* Enter a parse tree produced by the {@code Identifier}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void enterIdentifier(DecafParser.IdentifierContext ctx);
/**
* Exit a parse tree produced by the {@code Identifier}
* labeled alternative in {@link DecafParser#expr}.
* @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}.
* @param ctx the parse tree
*/
void enterExpression(DecafParser.ExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code Expression}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void exitExpression(DecafParser.ExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code Constant}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void enterConstant(DecafParser.ConstantContext ctx);
/**
* Exit a parse tree produced by the {@code Constant}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void exitConstant(DecafParser.ConstantContext ctx);
/**
* Enter a parse tree produced by the {@code BinaryOperation}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void enterBinaryOperation(DecafParser.BinaryOperationContext ctx);
/**
* Exit a parse tree produced by the {@code BinaryOperation}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void exitBinaryOperation(DecafParser.BinaryOperationContext ctx);
/**
* Enter a parse tree produced by the {@code StatementExpressionexpr}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void enterStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx);
/**
* Exit a parse tree produced by the {@code StatementExpressionexpr}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void exitStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#binaryOp}.
* @param ctx the parse tree
*/
void enterBinaryOp(DecafParser.BinaryOpContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#binaryOp}.
* @param ctx the parse tree
*/
void exitBinaryOp(DecafParser.BinaryOpContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#methCall}.
* @param ctx the parse tree
*/
void enterMethCall(DecafParser.MethCallContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#methCall}.
* @param ctx the parse tree
*/
void exitMethCall(DecafParser.MethCallContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#args}.
* @param ctx the parse tree
*/
void enterArgs(DecafParser.ArgsContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#args}.
* @param ctx the parse tree
*/
void exitArgs(DecafParser.ArgsContext ctx);
/**
* Enter a parse tree produced by {@link DecafParser#literal}.
* @param ctx the parse tree
*/
void enterLiteral(DecafParser.LiteralContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#literal}.
* @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
*/
void enterId(DecafParser.IdContext ctx);
/**
* Exit a parse tree produced by {@link DecafParser#id}.
* @param ctx the parse tree
*/
void exitId(DecafParser.IdContext ctx);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,235 @@
// Generated from C:/dev/Compilerbau/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link DecafParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface DecafVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link DecafParser#program}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitProgram(DecafParser.ProgramContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#class}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitClass(DecafParser.ClassContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#var}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVar(DecafParser.VarContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#returntype}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturntype(DecafParser.ReturntypeContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType(DecafParser.TypeContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#meth}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMeth(DecafParser.MethContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#mainmeth}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMainmeth(DecafParser.MainmethContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#params}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParams(DecafParser.ParamsContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#param}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParam(DecafParser.ParamContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBlock(DecafParser.BlockContext ctx);
/**
* Visit a parse tree produced by the {@code If}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIf(DecafParser.IfContext ctx);
/**
* Visit a parse tree produced by the {@code For}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor(DecafParser.ForContext ctx);
/**
* Visit a parse tree produced by the {@code While}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhile(DecafParser.WhileContext ctx);
/**
* Visit a parse tree produced by the {@code DoWhile}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDoWhile(DecafParser.DoWhileContext ctx);
/**
* Visit a parse tree produced by the {@code Return}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturn(DecafParser.ReturnContext ctx);
/**
* Visit a parse tree produced by the {@code ReturnVoid}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturnVoid(DecafParser.ReturnVoidContext ctx);
/**
* Visit a parse tree produced by the {@code Break}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBreak(DecafParser.BreakContext ctx);
/**
* Visit a parse tree produced by the {@code Continue}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitContinue(DecafParser.ContinueContext ctx);
/**
* Visit a parse tree produced by the {@code StatementExpressionstmt}
* labeled alternative in {@link DecafParser#stmt}.
* @param ctx the parse tree
* @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}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMethodCall(DecafParser.MethodCallContext ctx);
/**
* Visit a parse tree produced by the {@code New}
* labeled alternative in {@link DecafParser#stmtexpr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNew(DecafParser.NewContext ctx);
/**
* Visit a parse tree produced by the {@code Identifier}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
* @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}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExpression(DecafParser.ExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code Constant}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstant(DecafParser.ConstantContext ctx);
/**
* Visit a parse tree produced by the {@code BinaryOperation}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBinaryOperation(DecafParser.BinaryOperationContext ctx);
/**
* Visit a parse tree produced by the {@code StatementExpressionexpr}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatementExpressionexpr(DecafParser.StatementExpressionexprContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#binaryOp}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBinaryOp(DecafParser.BinaryOpContext 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#args}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArgs(DecafParser.ArgsContext ctx);
/**
* Visit a parse tree produced by {@link DecafParser#literal}.
* @param ctx the parse tree
* @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
* @return the visitor result
*/
T visitId(DecafParser.IdContext ctx);
}