index
1 /**************************************************
2 * file: main.cpp
3 * author: ideawu
4 * describe: for test
5 **************************************************/
6
7 #include <stdio.h>
8 #include "Parser.h"
9
10 int main(int argc, char* argv[]){
11 char *filename = "test.txt";
12 char *fileout = "";
13 FILE *fp = NULL;
14
15 if(argc > 1){
16 filename = argv[1];
17 }
18
19 if(argc > 2){
20 fileout = argv[2];
21 fp = fopen(fileout, "w");
22 }
23
24 Parser parser = Parser(filename);
25 SyntaxTree *tree = parser.parse();
26
27 if(tree!=NULL){
28 printf("\n************= Tree =****************:\n");
29 tree->display();
30 if(fp != NULL) tree->display(fp);
31 }else{
32 parser.printError();
33 }
34
35 if(fp != NULL) fclose(fp);
36
37 printf("\n");
38
39 return 0;
40 }
41
42
43