Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
968189a100 | ||
|
d6b4b41d3c | ||
|
ae22e8ab82 | ||
|
30596e0c52 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/src/main/java/de/dhbw/horb/antlr/
|
||||
.idea
|
10
.idea/.gitignore
generated
vendored
Normal file
10
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# GitHub Copilot persisted chat sessions
|
||||
/copilot/chatSessions
|
13
.idea/compiler.xml
generated
Normal file
13
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="decaf" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
BIN
.idea/copilot/chatSessions/00000000000.xd
generated
Normal file
BIN
.idea/copilot/chatSessions/00000000000.xd
generated
Normal file
Binary file not shown.
BIN
.idea/copilot/chatSessions/blobs/version
generated
Normal file
BIN
.idea/copilot/chatSessions/blobs/version
generated
Normal file
Binary file not shown.
47
.idea/copilot/chatSessions/xd.lck
generated
Normal file
47
.idea/copilot/chatSessions/xd.lck
generated
Normal file
@ -0,0 +1,47 @@
|
||||
Private property of Exodus: 41264@Simon-Lenovo-Ubuntu
|
||||
|
||||
jetbrains.exodus.io.LockingManager.lock(LockingManager.kt:88)
|
||||
jetbrains.exodus.io.LockingManager.lock(LockingManager.kt:39)
|
||||
jetbrains.exodus.io.FileDataWriter.lock(FileDataWriter.kt:70)
|
||||
jetbrains.exodus.log.Log.tryLock(Log.kt:804)
|
||||
jetbrains.exodus.log.Log.<init>(Log.kt:117)
|
||||
jetbrains.exodus.env.Environments.newLogInstance(Environments.kt:117)
|
||||
jetbrains.exodus.env.Environments.newLogInstance(Environments.kt:81)
|
||||
jetbrains.exodus.env.Environments.newLogInstance(Environments.kt:77)
|
||||
jetbrains.exodus.env.Environments$newInstance$4.invoke(Environments.kt:46)
|
||||
jetbrains.exodus.env.Environments$newInstance$4.invoke(Environments.kt:46)
|
||||
jetbrains.exodus.env.Environments.prepare(Environments.kt:120)
|
||||
jetbrains.exodus.env.Environments.newInstance(Environments.kt:46)
|
||||
kotlinx.dnq.store.container.EntityStoreHelperKt.createTransientEntityStore(EntityStoreHelper.kt:40)
|
||||
kotlinx.dnq.store.container.EntityStoreHelperKt.createTransientEntityStore(EntityStoreHelper.kt:31)
|
||||
kotlinx.dnq.store.container.EntityStoreHelperKt.createTransientEntityStore$default(EntityStoreHelper.kt:30)
|
||||
com.github.copilot.chat.session.persistence.xodus.XdChatSessionPersistenceService.initStore(XdChatSessionPersistenceService.kt:115)
|
||||
com.github.copilot.chat.session.persistence.xodus.XdChatSessionPersistenceService.<init>(XdChatSessionPersistenceService.kt:22)
|
||||
com.github.copilot.chat.session.persistence.xodus.XdChatSessionPersistenceService.<init>(XdChatSessionPersistenceService.kt:15)
|
||||
com.github.copilot.chat.session.persistence.ChatSessionPersistenceServiceKt.ChatSessionPersistenceService(ChatSessionPersistenceService.kt:43)
|
||||
com.github.copilot.chat.session.persistence.ChatSessionPersistenceServiceKt.chatSessionsPersistenceService(ChatSessionPersistenceService.kt:53)
|
||||
com.github.copilot.chat.session.ChatSessionManager.<init>(ChatSessionManager.kt:45)
|
||||
com.github.copilot.chat.session.ChatSessionManager.<init>(ChatSessionManager.kt:25)
|
||||
com.github.copilot.chat.window.CopilotChatToolWindow.onCopilotReady(CopilotChatToolWindow.kt:133)
|
||||
com.github.copilot.chat.window.CopilotChatToolWindow.access$onCopilotReady(CopilotChatToolWindow.kt:40)
|
||||
com.github.copilot.chat.window.CopilotChatToolWindow$initCopilotStatusListener$1.invoke(CopilotChatToolWindow.kt:118)
|
||||
com.github.copilot.chat.window.CopilotChatToolWindow$initCopilotStatusListener$1.invoke(CopilotChatToolWindow.kt:115)
|
||||
com.github.copilot.status.CopilotAuthStatusKt.subscribeToCopilotAuthStatus$lambda$0(CopilotAuthStatus.kt:44)
|
||||
com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:700)
|
||||
com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:664)
|
||||
com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:423)
|
||||
com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:402)
|
||||
com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
|
||||
com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:461)
|
||||
jdk.proxy6/jdk.proxy6.$Proxy166.onCopilotStatus(Unknown Source)
|
||||
com.github.copilot.status.CopilotStatusService.notifyApplication(CopilotStatusService.java:76)
|
||||
com.github.copilot.status.CopilotStatusService.notifyApplication(CopilotStatusService.java:64)
|
||||
com.github.copilot.github.GitHubAuthStartupActivity.handleAuthNotifications(GitHubAuthStartupActivity.java:54)
|
||||
com.github.copilot.github.GitHubAuthStartupActivity.execute(GitHubAuthStartupActivity.java:35)
|
||||
com.intellij.ide.startup.impl.StartupManagerImplKt$launchActivity$1.invokeSuspend(StartupManagerImpl.kt:482)
|
||||
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
|
||||
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
|
||||
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
|
||||
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
|
||||
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
|
||||
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
|
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
20
.idea/jarRepositories.xml
generated
Normal file
20
.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
28
.idea/misc.xml
generated
Normal file
28
.idea/misc.xml
generated
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ANTLRGenerationPreferences">
|
||||
<option name="perGrammarGenerationSettings">
|
||||
<list>
|
||||
<PerGrammarGenerationSettings>
|
||||
<option name="fileName" value="$PROJECT_DIR$/src/main/antlr4/de/dhbw/horb/Decaf.g4" />
|
||||
<option name="autoGen" value="true" />
|
||||
<option name="outputDir" value="$PROJECT_DIR$/src/main/java" />
|
||||
<option name="libDir" value="$PROJECT_DIR$/src/main/antlr4/de/dhbw/horb" />
|
||||
<option name="encoding" value="" />
|
||||
<option name="pkg" value="de.dhbw.horb.antlr" />
|
||||
<option name="language" value="" />
|
||||
<option name="generateVisitor" value="true" />
|
||||
</PerGrammarGenerationSettings>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
20
pom.xml
20
pom.xml
@ -12,8 +12,8 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>19</maven.compiler.source>
|
||||
<maven.compiler.target>19</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -32,22 +32,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin> <!-- ANTLR parser generation -->
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<version>4.11.1</version>
|
||||
<configuration>
|
||||
<visitor>true</visitor>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>antlr</id>
|
||||
<goals>
|
||||
<goal>antlr4</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
|
@ -1,43 +1,29 @@
|
||||
package de.dhbw.horb;
|
||||
|
||||
|
||||
import de.dhbw.horb.antlr.DecafParser;
|
||||
import de.dhbw.horb.ast.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ASTGenerator {
|
||||
|
||||
public static Program generateAST(DecafParser.ProgramContext parseTree){
|
||||
List<Variable> variables = new ArrayList<>();
|
||||
for(DecafParser.VarContext varCtx : parseTree.var()){
|
||||
variables.add(generateVariable(varCtx));
|
||||
}
|
||||
List<Function> funcs = new ArrayList<>();
|
||||
for(DecafParser.FuncContext fctx : parseTree.func()){
|
||||
funcs.add(generateFunc(fctx));
|
||||
}
|
||||
public static Program generateAST(DecafParser.ProgramContext parseTree) {
|
||||
List<Variable> variables = parseTree.var().stream().map(var -> new Variable(var.id().getText(), Type.mapType(var.type().getText()))).toList();
|
||||
List<Function> funcs = parseTree.func().stream().map(ASTGenerator::generateFunc).toList();
|
||||
return new Program(variables, funcs);
|
||||
}
|
||||
|
||||
public static Variable generateVariable(DecafParser.VarContext ctx) {
|
||||
return new Variable(ctx.id().getText(), getType(ctx.type()));
|
||||
}
|
||||
|
||||
public static Variable generateVariable(DecafParser.ParamContext ctx) {
|
||||
return new Variable(ctx.id().getText(), getType(ctx.type()));
|
||||
}
|
||||
|
||||
public static Function generateFunc(DecafParser.FuncContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
}
|
||||
|
||||
public static Type getType(DecafParser.TypeContext ctx){
|
||||
if(ctx.INT() != null)
|
||||
return Type.INT;
|
||||
if(ctx.BOOL() != null)
|
||||
return Type.BOOL;
|
||||
if(ctx.VOID() != null)
|
||||
return Type.VOID;
|
||||
throw new RuntimeException();
|
||||
Type t = Type.mapType(ctx.type().getText());
|
||||
String id = ctx.id().getText();
|
||||
List<Variable> params = Optional.ofNullable(ctx.params())
|
||||
.map(p -> p.param().stream().map(param -> new Variable(param.getText(), Type.mapType(param.type().getText()))).collect(Collectors.toList()))
|
||||
.orElseGet(ArrayList::new);
|
||||
Block block = new BlockGenerator().visit(ctx.block());
|
||||
return new Function(t, id, params, block);
|
||||
}
|
||||
}
|
||||
|
21
src/main/java/de/dhbw/horb/BlockGenerator.java
Normal file
21
src/main/java/de/dhbw/horb/BlockGenerator.java
Normal file
@ -0,0 +1,21 @@
|
||||
package de.dhbw.horb;
|
||||
|
||||
import de.dhbw.horb.antlr.DecafBaseVisitor;
|
||||
import de.dhbw.horb.antlr.DecafParser;
|
||||
import de.dhbw.horb.ast.Block;
|
||||
import de.dhbw.horb.ast.Statement;
|
||||
import de.dhbw.horb.ast.Type;
|
||||
import de.dhbw.horb.ast.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 Variable(var.id().getText(), Type.mapType(var.type().getText()))).toList();
|
||||
List<Statement> stmts = ctx.stmt().stream().map(stmt -> new StatementGenerator().visit(stmt)).toList();
|
||||
return new Block(vars, stmts);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,12 @@
|
||||
package de.dhbw.horb;
|
||||
|
||||
import de.dhbw.horb.ast.*;
|
||||
import de.dhbw.horb.antlr.DecafLexer;
|
||||
import de.dhbw.horb.antlr.DecafParser;
|
||||
import de.dhbw.horb.ast.Program;
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Decaf language Compiler
|
||||
*/
|
||||
|
@ -1,7 +1,13 @@
|
||||
package de.dhbw.horb;
|
||||
|
||||
import de.dhbw.horb.antlr.DecafParser;
|
||||
import de.dhbw.horb.antlr.DecafBaseVisitor;
|
||||
import de.dhbw.horb.ast.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
@Override
|
||||
public Expression visitBinaryOperation(DecafParser.BinaryOperationContext ctx) {
|
||||
@ -10,7 +16,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
|
||||
@Override
|
||||
public Expression visitFunCallExpression(DecafParser.FunCallExpressionContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new FunctionCall(ctx.funcCall().id().getText(), Optional.of(ctx.funcCall().args()).map(arg -> arg.expr().stream().map(this::visit).toList()).orElseGet(ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,25 +36,28 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
return generateLocation(ctx.loc());
|
||||
}
|
||||
|
||||
public static Expression generateConstant(DecafParser.LiteralContext ctx){
|
||||
if(ctx.number() != null)
|
||||
public static Expression generateConstant(DecafParser.LiteralContext ctx) {
|
||||
if (ctx.number() != null)
|
||||
return new IntConstant(Integer.valueOf(ctx.number().getText()));
|
||||
if(ctx.boolean_() != null)
|
||||
if (ctx.boolean_() != null)
|
||||
return new BoolConstant(Boolean.valueOf(ctx.boolean_().getText()));
|
||||
throw new RuntimeException();
|
||||
}
|
||||
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;
|
||||
|
||||
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();
|
||||
}
|
||||
public static Binary generateBinary(DecafParser.BinaryOperationContext ctx){
|
||||
|
||||
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 Location generateLocation(DecafParser.LocContext loc) {
|
||||
return new Location(loc.id().getText());
|
||||
}
|
||||
|
@ -1,44 +1,49 @@
|
||||
package de.dhbw.horb;
|
||||
|
||||
import de.dhbw.horb.antlr.DecafBaseVisitor;
|
||||
import de.dhbw.horb.antlr.DecafParser;
|
||||
import de.dhbw.horb.ast.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
public class StatementGenerator extends DecafBaseVisitor<Statement> {
|
||||
@Override
|
||||
public Statement visitAssign(DecafParser.AssignContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new Assignment(new Location(ctx.loc().getText()), new ExpressionGenerator().visit(ctx.expr()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitIf(DecafParser.IfContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
Block elseBlock = new Block(Collections.emptyList(), Collections.emptyList());
|
||||
if (ctx.block().size() > 1)
|
||||
elseBlock = new BlockGenerator().visit(ctx.block(1));
|
||||
return new IfElse(new ExpressionGenerator().visit(ctx.expr()), new BlockGenerator().visit(ctx.block(0)), elseBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitWhile(DecafParser.WhileContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new While(new ExpressionGenerator().visit(ctx.expr()), new BlockGenerator().visit(ctx.block()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitReturn(DecafParser.ReturnContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new Return(new ExpressionGenerator().visit(ctx.expr()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitReturnVoid(DecafParser.ReturnVoidContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new ReturnVoid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitBreak(DecafParser.BreakContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new Break();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement visitContinue(DecafParser.ContinueContext ctx) {
|
||||
throw new RuntimeException("TODO");
|
||||
return new Continue();
|
||||
}
|
||||
|
||||
}
|
||||
|
78
src/main/java/de/dhbw/horb/antlr/Decaf.interp
Normal file
78
src/main/java/de/dhbw/horb/antlr/Decaf.interp
Normal file
@ -0,0 +1,78 @@
|
||||
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:
|
||||
program
|
||||
var
|
||||
type
|
||||
func
|
||||
params
|
||||
param
|
||||
block
|
||||
stmt
|
||||
expr
|
||||
binaryOp
|
||||
loc
|
||||
funcCall
|
||||
args
|
||||
literal
|
||||
boolean
|
||||
number
|
||||
id
|
||||
|
||||
|
||||
atn:
|
||||
[4, 1, 25, 167, 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, 1, 0, 1, 0, 5, 0, 37, 8, 0, 10, 0, 12, 0, 40, 9, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 53, 8, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 5, 4, 61, 8, 4, 10, 4, 12, 4, 64, 9, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 5, 6, 71, 8, 6, 10, 6, 12, 6, 74, 9, 6, 1, 6, 5, 6, 77, 8, 6, 10, 6, 12, 6, 80, 9, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 99, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 117, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 127, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 133, 8, 8, 10, 8, 12, 8, 136, 9, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 3, 11, 145, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 152, 8, 12, 10, 12, 12, 12, 155, 9, 12, 1, 13, 1, 13, 3, 13, 159, 8, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 0, 1, 16, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 0, 3, 1, 0, 20, 22, 1, 0, 17, 19, 1, 0, 15, 16, 170, 0, 38, 1, 0, 0, 0, 2, 41, 1, 0, 0, 0, 4, 45, 1, 0, 0, 0, 6, 47, 1, 0, 0, 0, 8, 57, 1, 0, 0, 0, 10, 65, 1, 0, 0, 0, 12, 68, 1, 0, 0, 0, 14, 116, 1, 0, 0, 0, 16, 126, 1, 0, 0, 0, 18, 137, 1, 0, 0, 0, 20, 139, 1, 0, 0, 0, 22, 141, 1, 0, 0, 0, 24, 148, 1, 0, 0, 0, 26, 158, 1, 0, 0, 0, 28, 160, 1, 0, 0, 0, 30, 162, 1, 0, 0, 0, 32, 164, 1, 0, 0, 0, 34, 37, 3, 2, 1, 0, 35, 37, 3, 6, 3, 0, 36, 34, 1, 0, 0, 0, 36, 35, 1, 0, 0, 0, 37, 40, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 1, 1, 0, 0, 0, 40, 38, 1, 0, 0, 0, 41, 42, 3, 4, 2, 0, 42, 43, 3, 32, 16, 0, 43, 44, 5, 1, 0, 0, 44, 3, 1, 0, 0, 0, 45, 46, 7, 0, 0, 0, 46, 5, 1, 0, 0, 0, 47, 48, 5, 2, 0, 0, 48, 49, 3, 4, 2, 0, 49, 50, 3, 32, 16, 0, 50, 52, 5, 3, 0, 0, 51, 53, 3, 8, 4, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 55, 5, 4, 0, 0, 55, 56, 3, 12, 6, 0, 56, 7, 1, 0, 0, 0, 57, 62, 3, 10, 5, 0, 58, 59, 5, 5, 0, 0, 59, 61, 3, 10, 5, 0, 60, 58, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 9, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 66, 3, 4, 2, 0, 66, 67, 3, 32, 16, 0, 67, 11, 1, 0, 0, 0, 68, 72, 5, 6, 0, 0, 69, 71, 3, 2, 1, 0, 70, 69, 1, 0, 0, 0, 71, 74, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 78, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 75, 77, 3, 14, 7, 0, 76, 75, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 81, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 81, 82, 5, 7, 0, 0, 82, 13, 1, 0, 0, 0, 83, 84, 3, 20, 10, 0, 84, 85, 5, 8, 0, 0, 85, 86, 3, 16, 8, 0, 86, 87, 5, 1, 0, 0, 87, 117, 1, 0, 0, 0, 88, 89, 3, 22, 11, 0, 89, 90, 5, 1, 0, 0, 90, 117, 1, 0, 0, 0, 91, 92, 5, 9, 0, 0, 92, 93, 5, 3, 0, 0, 93, 94, 3, 16, 8, 0, 94, 95, 5, 4, 0, 0, 95, 98, 3, 12, 6, 0, 96, 97, 5, 10, 0, 0, 97, 99, 3, 12, 6, 0, 98, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 117, 1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 5, 3, 0, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 4, 0, 0, 104, 105, 3, 12, 6, 0, 105, 117, 1, 0, 0, 0, 106, 107, 5, 12, 0, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 1, 0, 0, 109, 117, 1, 0, 0, 0, 110, 111, 5, 12, 0, 0, 111, 117, 5, 1, 0, 0, 112, 113, 5, 13, 0, 0, 113, 117, 5, 1, 0, 0, 114, 115, 5, 14, 0, 0, 115, 117, 5, 1, 0, 0, 116, 83, 1, 0, 0, 0, 116, 88, 1, 0, 0, 0, 116, 91, 1, 0, 0, 0, 116, 100, 1, 0, 0, 0, 116, 106, 1, 0, 0, 0, 116, 110, 1, 0, 0, 0, 116, 112, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 117, 15, 1, 0, 0, 0, 118, 119, 6, 8, -1, 0, 119, 127, 3, 26, 13, 0, 120, 121, 5, 3, 0, 0, 121, 122, 3, 16, 8, 0, 122, 123, 5, 4, 0, 0, 123, 127, 1, 0, 0, 0, 124, 127, 3, 22, 11, 0, 125, 127, 3, 20, 10, 0, 126, 118, 1, 0, 0, 0, 126, 120, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 125, 1, 0, 0, 0, 127, 134, 1, 0, 0, 0, 128, 129, 10, 5, 0, 0, 129, 130, 3, 18, 9, 0, 130, 131, 3, 16, 8, 6, 131, 133, 1, 0, 0, 0, 132, 128, 1, 0, 0, 0, 133, 136, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 17, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 137, 138, 7, 1, 0, 0, 138, 19, 1, 0, 0, 0, 139, 140, 3, 32, 16, 0, 140, 21, 1, 0, 0, 0, 141, 142, 3, 32, 16, 0, 142, 144, 5, 3, 0, 0, 143, 145, 3, 24, 12, 0, 144, 143, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 147, 5, 4, 0, 0, 147, 23, 1, 0, 0, 0, 148, 153, 3, 16, 8, 0, 149, 150, 5, 5, 0, 0, 150, 152, 3, 16, 8, 0, 151, 149, 1, 0, 0, 0, 152, 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 25, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 159, 3, 30, 15, 0, 157, 159, 3, 28, 14, 0, 158, 156, 1, 0, 0, 0, 158, 157, 1, 0, 0, 0, 159, 27, 1, 0, 0, 0, 160, 161, 7, 2, 0, 0, 161, 29, 1, 0, 0, 0, 162, 163, 5, 24, 0, 0, 163, 31, 1, 0, 0, 0, 164, 165, 5, 23, 0, 0, 165, 33, 1, 0, 0, 0, 13, 36, 38, 52, 62, 72, 78, 98, 116, 126, 134, 144, 153, 158]
|
47
src/main/java/de/dhbw/horb/antlr/Decaf.tokens
Normal file
47
src/main/java/de/dhbw/horb/antlr/Decaf.tokens
Normal file
@ -0,0 +1,47 @@
|
||||
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
|
||||
';'=1
|
||||
'def'=2
|
||||
'('=3
|
||||
')'=4
|
||||
','=5
|
||||
'{'=6
|
||||
'}'=7
|
||||
'='=8
|
||||
'if'=9
|
||||
'else'=10
|
||||
'while'=11
|
||||
'return'=12
|
||||
'break'=13
|
||||
'continue'=14
|
||||
'true'=15
|
||||
'false'=16
|
||||
'-'=17
|
||||
'+'=18
|
||||
'*'=19
|
||||
'int'=20
|
||||
'bool'=21
|
||||
'void'=22
|
376
src/main/java/de/dhbw/horb/antlr/DecafBaseListener.java
Normal file
376
src/main/java/de/dhbw/horb/antlr/DecafBaseListener.java
Normal file
@ -0,0 +1,376 @@
|
||||
// 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.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 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 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 enterFunc(DecafParser.FuncContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitFunc(DecafParser.FuncContext 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 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 enterFunctionCall(DecafParser.FunctionCallContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitFunctionCall(DecafParser.FunctionCallContext 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 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 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 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 enterFunCallExpression(DecafParser.FunCallExpressionContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitFunCallExpression(DecafParser.FunCallExpressionContext 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 enterLocation(DecafParser.LocationContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitLocation(DecafParser.LocationContext 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 enterLoc(DecafParser.LocContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitLoc(DecafParser.LocContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterFuncCall(DecafParser.FuncCallContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitFuncCall(DecafParser.FuncCallContext 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 enterNumber(DecafParser.NumberContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitNumber(DecafParser.NumberContext 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) { }
|
||||
}
|
211
src/main/java/de/dhbw/horb/antlr/DecafBaseVisitor.java
Normal file
211
src/main/java/de/dhbw/horb/antlr/DecafBaseVisitor.java
Normal file
@ -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.
|
||||
*
|
||||
* @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 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 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 visitFunc(DecafParser.FuncContext 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 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 visitFunctionCall(DecafParser.FunctionCallContext 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 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 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 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 visitFunCallExpression(DecafParser.FunCallExpressionContext 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 visitLocation(DecafParser.LocationContext 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 visitLoc(DecafParser.LocContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitFuncCall(DecafParser.FuncCallContext 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 visitNumber(DecafParser.NumberContext 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); }
|
||||
}
|
92
src/main/java/de/dhbw/horb/antlr/DecafLexer.interp
Normal file
92
src/main/java/de/dhbw/horb/antlr/DecafLexer.interp
Normal file
@ -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]
|
210
src/main/java/de/dhbw/horb/antlr/DecafLexer.java
Normal file
210
src/main/java/de/dhbw/horb/antlr/DecafLexer.java
Normal file
@ -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"
|
||||