-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyrpal.java
More file actions
48 lines (43 loc) · 1.45 KB
/
myrpal.java
File metadata and controls
48 lines (43 loc) · 1.45 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Engine.Evaluvator;
public class myrpal {
public static void main(String[] args) {
String fn;
boolean isPrintAST=false,isPrintST=false;
if(args.length==0){
fn = "input.txt";
isPrintAST = true;
isPrintST = true;
}
else if(args.length==3 && (
(args[0].equalsIgnoreCase("-ast") && args[1].equalsIgnoreCase("-st")) ||
(args[0].equalsIgnoreCase("-st") && args[1].equalsIgnoreCase("-ast"))
)
)
{
fn = args[2];
isPrintAST=true;
isPrintST=true;
}
else if(args.length==2){
fn=args[1];
if(args[0].equalsIgnoreCase("-ast")){
isPrintAST=true;
}
else if(args[0].equalsIgnoreCase("-st")){
isPrintST=true;
}
else{
System.out.println("Invalid Arguments Passing!");
return;
}
}
else if(args.length==1){
fn = args[0];
}
else{
System.out.println("Invalid Arguments Passing!");
return;
}
System.out.println(Evaluvator.evaluvate(fn,isPrintAST,isPrintST)); // get and print the answer
}
}