-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnewlang4Main.java
More file actions
37 lines (30 loc) · 849 Bytes
/
Copy pathnewlang4Main.java
File metadata and controls
37 lines (30 loc) · 849 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
35
36
37
import newlang3.*;
import newlang4.*;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class newlang4Main {
public static void main(String[] args) throws Exception {
InputStream in;
String fileName="test.bas";
LexicalAnalyzer lex;
Environment env;
Node program;
System.out.println("basic parser");
if (args.length>0){
fileName=args[0];
}
try{
in=new FileInputStream(fileName);
} catch(IOException e) {
System.out.println(fileName+"を読み込めませんでした。");
return;
}
lex = new LexicalAnalyzerImpl(in);
env = new Environment(lex);
program = Program.getHandler(env);
program.parse();
System.out.println(program.toString(0));
// System.out.println("value = " + program.getValue());
}
}