-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmgi.java
36 lines (30 loc) · 1.23 KB
/
mgi.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
30
31
32
33
34
35
36
import interpreter.command.Command;
import lexical.LexicalAnalysis;
import syntatic.SyntaticAnalysis;
public class mgi {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: java mgi [miniGroovy file]");
return;
}
try (LexicalAnalysis l = new LexicalAnalysis(args[0])) {
// O código a seguir é dado para testar o interpretador.
// TODO: descomentar depois que o analisador léxico estiver OK.
SyntaticAnalysis s = new SyntaticAnalysis(l);
Command c = s.start();
c.execute();
// O código a seguir é usado apenas para testar o analisador léxico.
// TODO: depois de pronto, comentar o código abaixo.
// Lexeme lex;
// do {
// lex = l.nextToken();
// System.out.printf("%02d: (\"%s\", %s)\n", l.getLine(),
// lex.token, lex.type);
// } while (lex.type != TokenType.END_OF_FILE &&
// lex.type != TokenType.INVALID_TOKEN &&
// lex.type != TokenType.UNEXPECTED_EOF);
} catch (Exception e) {
System.err.println("Internal error: " + e.getMessage());
}
}
}