-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
66 lines (49 loc) · 1.23 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "loader.h"
#include "limits.h"
#include "syntax.h"
#include "identifierTable.h"
#include <stdio.h>
#include <cstdlib>
#include <string.h>
#include <stack>
#include <malloc.h>
#include <iostream>
#include "irgen.h"
using namespace std;
int main( int argc, char *argv[] )
{
FILE *pre = fopen("/home/ahmad/ClionProjects/export.c","w");
token *head;
// Loading phase
if(argc <= 1){
printf("Enter the file path to compile : \n");
char *path = (char *)malloc(1000 * sizeof(char));
scanf("%s",path);
preProces(pre,argv[1]);
}else{
preProces(pre,argv[1]);
}
fclose(pre);
printf("Pre process step completed.\n");
head = loadfromfile("/home/ahmad/ClionProjects/export.c");
token *ptr = head;
/*
while (ptr != NULL)
{
printf("%d : %s s:%d\n",ptr->lineNumber,ptr->value,ptr->type);
ptr=ptr->next;
}
*/
printf("Preprocess completed.\n");
checkPunc(head);
Tcheck(head,'}');
// Check whether any error occurred in the phase or not
if(isAnyErr()){
generateIR(head,"/home/ahmad/ClionProjects/file.ir");
return 0;
}
//Keycheck(head);
//statement(head);
//mainAnalyser(head);
return 0;
}