-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
32 lines (26 loc) · 861 Bytes
/
Program.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
30
31
32
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Antlr4.Runtime;
using Antlr4.Runtime.Tree;
namespace ANTLR_Startup_Project
{
class Program
{
static void Main(string[] args)
{
StreamReader astream = new StreamReader("test.txt");
AntlrInputStream antlrStream=new AntlrInputStream(astream);
firstLexer lexer = new firstLexer(antlrStream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
firstParser parser = new firstParser(tokens);
IParseTree tree = parser.compileUnit();
GraphvizPrinterVisitor printer = new GraphvizPrinterVisitor();
printer.Visit(tree);
Console.WriteLine(tree.ToStringTree());
}
}
}