transcendental-lisp/src/main/LispMain.java

28 lines
663 B
Java
Raw Normal View History

package main;
import interpreter.*;
public class LispMain {
private LispMain() {}
public static void main(String[] args) {
LispInterpreter interpreter = buildInterpreter(args);
interpreter.interpret();
}
private static LispInterpreter buildInterpreter(String[] args) {
LispInterpreterBuilder builder = new LispInterpreterBuilderImpl();
builder.setInput(System.in);
builder.setOutput(System.out);
builder.setErrorOutput(System.err);
builder.setTerminate(() -> System.exit(1));
if (args.length > 0)
builder.useFile(args[0]);
return builder.build();
}
}