-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMain.cs
29 lines (25 loc) · 881 Bytes
/
Main.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Antlr.Runtime;
public class JSMinusMain {
public static void Main(string[] args) {
try {
if (args.Length < 1) {
System.Console.WriteLine("Usage : JSMinus file");
return;
}
ICharStream input = new ANTLRFileStream(args[0]);
JSMinusLexer lexer = new JSMinusLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
JSMinusParser parser = new JSMinusParser(tokens);
CodeEmitor emitor = new CodeEmitor("JSMinus", parser.program());
emitor.save();
emitor.run();
} catch (System.Exception e) {
Console.Error.WriteLine(e.StackTrace);
Console.Error.WriteLine("Exception: " + e);
}
}
}