2016-12-17 10:19:18 -05:00
|
|
|
package main;
|
|
|
|
|
|
|
|
import interpreter.*;
|
|
|
|
|
|
|
|
public class LispMain {
|
|
|
|
|
|
|
|
private LispMain() {}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2017-01-17 13:54:21 -05:00
|
|
|
LispInterpreter interpreter = buildInterpreter(args);
|
2016-12-17 10:19:18 -05:00
|
|
|
interpreter.interpret();
|
|
|
|
}
|
|
|
|
|
2017-01-17 13:54:21 -05:00
|
|
|
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));
|
2016-12-17 10:19:18 -05:00
|
|
|
|
2017-01-17 13:54:21 -05:00
|
|
|
if (args.length > 0)
|
|
|
|
builder.useFile(args[0]);
|
2016-12-17 10:19:18 -05:00
|
|
|
|
2017-01-17 13:54:21 -05:00
|
|
|
return builder.build();
|
2016-12-17 10:19:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|