package org.zwobble.hobgoblin.compiler.interpreter; import org.zwobble.hobgoblin.compiler.ast.typed.*; import org.zwobble.hobgoblin.compiler.types.TypeLevelValueType; import java.util.List; public class Interpreter { private final InterpreterConfig config; public Interpreter(InterpreterConfig config) { this.config = config; } public TValue evalStatements( List statements ) { for (var statement : statements) { switch (statement) { case TypedReturnNode return_ -> { return evalExpression(return_.expression()); } } } throw new UnsupportedOperationException("TODO: missing return"); } public TValue evalExpression( TypedExpressionNode expression ) { if (expression.type() instanceof TypeLevelValueType typeLevelValue) { return config.typeLevelValueToValue(typeLevelValue.value()); } throw new UnsupportedOperationException("TODO"); } }