-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (23 loc) · 678 Bytes
/
Copy pathmain.cpp
File metadata and controls
29 lines (23 loc) · 678 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
#include <iostream>
#include "antlr4-runtime.h"
#include "PascalSLexer.h"
#include "PascalSParser.h"
#include "semantics.hpp"
#include "SymbolTable.hpp"
//#include "PascalSBaseListener.h"
using namespace antlr4;
int main(int agrc, char* argv[]){
std::ifstream stream(argv[1]);
ANTLRInputStream input(stream);
// Create antlr lexer
PascalSLexer lexer(&input);
CommonTokenStream tokens(&lexer);
// Create antlr parser
PascalSParser parser(&tokens);
// Create parser tree and set initial rule
tree::ParseTree *tree = parser.program();
semanticsListener listener;
//PascalSBaseListener listener;
tree::ParseTreeWalker::DEFAULT.walk(&listener, tree);
return 0;
}