-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
50 lines (35 loc) · 1.03 KB
/
main.cpp
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
/**
RIGHT TO USE, DISTRIBUTE AND MODIFY
===================================
Copyright (C) 2015 Ganesh Prasad Sahoo - All Rights Reserved
You may use, distribute and modify this code under the Terms
of GNU GPL V3 License. You should have received a copy of the
GNU GPL v3 License with this file. If not please write to
sir.gnsp@gmail.com
or visit
http://www.gnu.org/licenses/gpl.txt
*****************************************************************************
*/
#include "parser.hpp"
using namespace std;
int main(int argc, char *argv[]){
streampos size;
char *program;
if(argc !=3){
cout<<"Usage : erdcc <source file name> <out file name>"<<endl;
}
ifstream file (argv[1], ios::in|ios::ate);
if (file.is_open()){
size = file.tellg();
program = new char [size];
file.seekg (0, ios::beg);
file.read (program, size);
file.close();
Parser compiler(program);
compiler.parse();
compiler.generateCode(argv[2]);
delete [] program;
}
else cout << "Unable to open source file"<<endl;
return 0;
}