Compare commits

...

2 Commits

Author SHA1 Message Date
JonathanFleischmann
8ea08b564d implemented ExpressionGenerator 2024-03-20 13:06:24 +01:00
JonathanFleischmann
379e622284 added git resources 2024-03-20 11:20:05 +01:00
7 changed files with 94 additions and 1 deletions

10
.idea/.gitignore vendored Normal file
View 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
../target/

14
.idea/compiler.xml Normal file
View File

@ -0,0 +1,14 @@
<?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="Uebungsblatt2" />
<module name="decaf" />
</profile>
</annotationProcessing>
</component>
</project>

7
.idea/encodings.xml Normal file
View 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 Normal file
View 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 Normal file
View 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="C:\eigene Dateien\Duales Studium\Compilerbau\Uebungsblatt2\src\main\java" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="de.dhbw.horb.ast" />
<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" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK" />
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -2,6 +2,9 @@ package de.dhbw.horb;
import de.dhbw.horb.ast.*; import de.dhbw.horb.ast.*;
import java.util.ArrayList;
import java.util.List;
public class ExpressionGenerator extends DecafBaseVisitor<Expression> { public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
@Override @Override
public Expression visitBinaryOperation(DecafParser.BinaryOperationContext ctx) { public Expression visitBinaryOperation(DecafParser.BinaryOperationContext ctx) {
@ -10,7 +13,12 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
@Override @Override
public Expression visitFunCallExpression(DecafParser.FunCallExpressionContext ctx) { public Expression visitFunCallExpression(DecafParser.FunCallExpressionContext ctx) {
throw new RuntimeException("TODO"); String functionName = ctx.funcCall().id().getText();
List<Expression> exprList = new ArrayList<>();
for (var expr: ctx.funcCall().args().expr()) {
exprList.add(expr.accept(this));
}
return new FunctionCall(functionName, exprList);
} }
@Override @Override