-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYui.c
61 lines (53 loc) · 991 Bytes
/
Yui.c
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
#include<stdio.h>
#include<stdlib.h>
#include "ylib.h"
#include "state.h"
/*
Yui.c
@author octobershiner
@version 0.1
2011 12 02
Description: The main entry of the Yui Compiler.
*/
struct Node * Table; /*符号表入口*/
struct Node * Token; /*token序列*/
struct TreeNode * SyntaxTree; /*语法分析树*/
struct CodeNode * Code; /*中间代码*/
int Token_Error = NO;
int Syntax_Error = NO;
int Sem_Error = NO;
/*主函数入口*/
int main ( int argc , char * argv[] )
{
hello();
Table = initTable(Table);
Code = initCode(Code);
scanner(argv[1]);
writeTokenFile(Token);
parser();
if(argc>2&&strcmp(argv[2],"-f")==0)
{
printToken(Table);
}
else if(argc>2&&strcmp(argv[2],"-g")==0)
{
graphviz();
}
else if(argc>2&&strcmp(argv[2],"-p")==0)
{
printCode(Code);
}
writeCode(Code);
/*
initStack();
push(1);
push(2);
push(3);
pop();
if(searchStack(1)==YES)
{
printf("find it\n");
}
*/
return 0;
}