-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateCode.h
59 lines (53 loc) · 1.41 KB
/
generateCode.h
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
#ifndef _CODE_GEN_
#define _CODE_GEN_
#define DEBUG 0
static const char* SYMBOLS_TYPE_SIZE[] = { "void", "i32", "i1",
"%.ArrayInt", "%.ArrayBool", "i8*", "Id", "i32",
"i1", "i1*", };
static const char *CODE_OPERATOR_STRING[] = {"Program",
"VarDecl",
"MethodDecl",
"MethodParams",
"MethodBody",
"ParamDeclaration",
"CompoundStat",
"if",
"System.out.println",
"return",
"=",
"mul",
"sdiv",
"srem",
"!",
"sub",
"add",
".length",
"[",
"call",
"new int",
"new boolean",
"Integer.parseInt",
"while",
"=",
"IntLit",
"BoolLit",
"Id",
"and",
"or",
"slt",
"sgt",
"sle",
"sge",
"ne",
"eq",
"null",
"+",
"-"
};
char* generateCode(Node* ast,Table* main);
typedef struct _callP{
Type type;
char name[100];
struct _callP* next;
}callParams;
#endif