package function.builtin;

import environment.RuntimeEnvironment;
import function.*;
import sexpression.*;

@FunctionNames({ "EXIT" })
public class EXIT extends LispFunction {

    private ArgumentValidator argumentValidator;
    private RuntimeEnvironment environment;

    public EXIT() {
        this.argumentValidator = new ArgumentValidator("EXIT");
        this.argumentValidator.setMaximumNumberOfArguments(0);
        this.environment = RuntimeEnvironment.getInstance();
    }

    public SExpression call(Cons argumentList) {
        argumentValidator.validate(argumentList);
        environment.terminateSuccessfully();

        return Nil.getInstance();
    }

}
