-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrpal20.java
More file actions
34 lines (32 loc) · 887 Bytes
/
rpal20.java
File metadata and controls
34 lines (32 loc) · 887 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
28
29
30
31
32
33
34
/*
* **************************************************
* MAIN CLASS to run
* **************************************************
*/
public class rpal20 {
public static void main(String args[]){
String fileName = "";
String AST_Text = "";
if (args.length == 0) { //No switches => no output
System.exit(0);
}
else if (args.length == 1) {
fileName = args[0];
Parser p = new Parser(fileName);
Node AST = p.getAST();
STTransformer TreeConstructor = new STTransformer();
TreeConstructor.constructAST(AST);
TreeConstructor.constructST();
}
else if (args.length == 2 && args[0].equalsIgnoreCase("-ast")) { //Generate AST by reading FILE
fileName = args[1];
Parser p = new Parser(fileName);
AST_Text = p.startParsing();
System.out.print(AST_Text);
}
else {
System.err.println("Error: Illegal parameters");
System.exit(0);
}
}
}