finish ExpressionGenerator
This commit is contained in:
parent
2b90f84c1e
commit
04978dafe3
@ -2,6 +2,9 @@ package de.dhbw.horb;
|
|||||||
|
|
||||||
import de.dhbw.horb.ast.*;
|
import de.dhbw.horb.ast.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
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,10 @@ 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 name = ctx.funcCall().id().getText();
|
||||||
|
List<DecafParser.ExprContext> expressions = ctx.funcCall().args().expr();
|
||||||
|
List<Expression> args = expressions.stream().map(this::visit).toList();
|
||||||
|
return new FunctionCall(name, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user