-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.java
29 lines (27 loc) · 1.12 KB
/
Driver.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
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import java.io.FileReader;
import java.io.IOException;
public class Driver {
public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.out.println("Usage: java Driver <test-file>\n\t\tProvide name of test file as argument.");
return;
}
boolean IsDebugEnable = false;
if (args.length > 1){
IsDebugEnable = Boolean.parseBoolean(args[1]);
}
CharStream input = CharStreams.fromReader(new FileReader(args[0]));
LoopNestLexer lexer = new LoopNestLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
LoopNestParser parser = new LoopNestParser(tokens);
parser.setBuildParseTree(true);
ParseTree tree = parser.tests();
Analysis cacheMissAnalysis = new Analysis(IsDebugEnable);
ParseTreeWalker.DEFAULT.walk(cacheMissAnalysis, tree);
}
}