-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeCheckingTest.java
More file actions
27 lines (26 loc) · 886 Bytes
/
TypeCheckingTest.java
File metadata and controls
27 lines (26 loc) · 886 Bytes
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
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.Reader;
public class TypeCheckingTest {
public static void main(String[] args) {
Reader reader = null;
try {
if (args.length == 1) {
File input = new File(args[0]);
reader = new FileReader(input);
} else {
reader = new InputStreamReader(System.in);
}
Lexer lexer = new Lexer(reader);
parser parser = new parser(lexer);
Program program = (Program) parser.parse().value;
program.typeCheck();
System.err.print("All good!");
} catch (SemanticException semanticException) {
System.err.print(semanticException);
} catch (Exception exception) {
exception.printStackTrace();
}
}
}