-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.cpp
More file actions
38 lines (30 loc) · 777 Bytes
/
Copy pathfrontend.cpp
File metadata and controls
38 lines (30 loc) · 777 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
30
31
32
33
34
35
36
37
38
#include "string.h"
#include "ctype.h"
#include "stdio.h"
#include "stdlib.h"
#include "headers/differentiator.h"
#include "headers/input_output.h"
#include "headers/recursive_descent.h"
#include "headers/stack.h"
static void compiler (char* prog);
int main (int argc, char* argv[])
{
char* inpName = (char*)"prog.txt";
if (argc != 1)
inpName = argv[1];
FILE* prog = fopen(inpName, "rb");
char* programm = NULL;
fill_buffer(prog, &programm);
remove_enters(programm);
printf("%s\n", programm);
compiler(programm);
}
void compiler (char* prog)
{
Node* programm = get_g(prog);
draw_tree(programm);
// print_tree(programm);
FILE* out = fopen("prog_tree.txt", "wb");
fprint_tree(out, programm);
fclose(out);
}