Compare commits
No commits in common. "f69e5df5e73b946993f0d8a19b6f4f7e346305e3" and "2b90f84c1e7b6f9be583c23ea6a5cc54ba74b8fe" have entirely different histories.
f69e5df5e7
...
2b90f84c1e
@ -2,8 +2,6 @@ package de.dhbw.horb;
|
||||
|
||||
import de.dhbw.horb.ast.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
@Override
|
||||
public Expression visitBinaryOperation(DecafParser.BinaryOperationContext ctx) {
|
||||
@ -12,7 +10,7 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
|
||||
@Override
|
||||
public Expression visitFunCallExpression(DecafParser.FunCallExpressionContext ctx) {
|
||||
return generateFunctionCall(ctx.funcCall());
|
||||
throw new RuntimeException("TODO");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,14 +30,6 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
return generateLocation(ctx.loc());
|
||||
}
|
||||
|
||||
public static FunctionCall generateFunctionCall(DecafParser.FuncCallContext ctx) {
|
||||
String name = ctx.id().getText();
|
||||
List<DecafParser.ExprContext> expressions = ctx.args().expr();
|
||||
List<Expression> args = expressions.stream()
|
||||
.map(exp -> new ExpressionGenerator().visit(exp)).toList();
|
||||
return new FunctionCall(name, args);
|
||||
}
|
||||
|
||||
public static Expression generateConstant(DecafParser.LiteralContext ctx){
|
||||
if(ctx.number() != null)
|
||||
return new IntConstant(Integer.valueOf(ctx.number().getText()));
|
||||
|
Loading…
Reference in New Issue
Block a user