-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZeroFucks.java
33 lines (30 loc) · 984 Bytes
/
ZeroFucks.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* TODO:
* - test different exceptions,
* including ArrayIndexOutOfBoundsException
* - fix some interpreter bugs, namely in linux
* where the prompt prints twice without a newline
* character after a REPL cycle
*/
import java.io.IOException;
public class ZeroFucks
{
public static void main(String[] args) throws Exception
{
try {
// interpret until "exit()" is caught
if (args[0].equals("interactive")) {
Interpreter zeroFucks = new Interpreter();
zeroFucks.interpretEachLine();
}
TapeParser parser = new TapeParser(args[0]);
parser.eval(new Memory());
} catch (IOException e) {
Utils.die("Error: couldn't find file " + args[0]);
} catch (ArrayIndexOutOfBoundsException e) {
Utils.die("Error: no file provided");
} catch (Exception e) {
Utils.die("Error: something occurred!");
}
}
}