-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtqlmain.cpp
More file actions
56 lines (47 loc) · 1.22 KB
/
Copy pathtqlmain.cpp
File metadata and controls
56 lines (47 loc) · 1.22 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using namespace std;
#include <iostream>
#include <fstream>
#include "tqlparse.tab.hh"
#include "MyParser.h"
#include "FlexLexer.h"
#include "MyFlexLexer.h"
int main(int argc, char **argv)
{
if (argc==2)
{
ifstream is(argv[1]);
if (is.is_open())
{
ofstream os("tqlast.json");
ofstream tos("tqlir.txt");
if (os.is_open() && tos.is_open())
{
MyParser *driver=new MyParser(&os, &tos);
yy::MyParserBase *base=new yy::MyParserBase(driver);
driver->parse(base, &is);
is.close();
if (driver->getParseErrorLine()>=0)
{
cout << "Not recognized!" << endl;
driver->reportError();
}
else
{
cout << "Recognized!" << endl;
driver->generateIC();
driver->reportFindings();
}
delete driver;
os.close();
}
else
cout << "Unable to create output file."<<endl;
is.close();
}
else
cout << "Unable to open input file "<<argv[1]<<endl;
}
else
cout << "Usage is: "<<argv[0]<<" <input-file-name>"<<endl;
return 0;
}