use of org.whole.lang.scheme.model.ConstExpression in project whole by wholeplatform.
the class SchemeInterpreterVisitor method visit.
public void visit(ApplyExpression entity) {
IEntity exprs = entity.getExpressions();
if (!exprs.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.SchemeExpressions))
throw new VisitException("expected a " + SchemeEntityDescriptorEnum.SchemeExpressions);
if (exprs.wIsEmpty())
throw new VisitException("empty application");
ConstExpression head = (ConstExpression) evaluate((SchemeExpression) exprs.wGet(0));
ConstExpression[] args = new ConstExpression[exprs.wSize() - 1];
for (int i = 1; i < exprs.wSize(); i++) args[i - 1] = (ConstExpression) evaluate(((SchemeExpression) exprs.wGet(i)));
apply(head, args);
}
Aggregations