-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
28 lines (27 loc) · 1.02 KB
/
Main.java
File metadata and controls
28 lines (27 loc) · 1.02 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
import java.io.FileReader;
import java.io.Reader;
import java_cup.runtime.Symbol;
@SuppressWarnings("unused")
public class Main {
@SuppressWarnings("deprecation")
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Usage: java Main <source-file1> <source-file2> ...]");
System.exit(0);
}
for (String filename : args) {
System.out.println("--------------");
System.out.println("Processing file: " + filename);
System.out.println("--------------");
try (Reader reader = new FileReader(filename)) {
SASLexer lexer = new SASLexer(reader);
SASParser parser = new SASParser(lexer);
parser.parse();
System.out.println("Parsed "+filename+" successfully!");
} catch (Exception e) {
System.err.println("I/O error in " + filename + ": " + e.getMessage());
e.printStackTrace();
}
}
}
}