-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheader.h
More file actions
49 lines (41 loc) · 952 Bytes
/
header.h
File metadata and controls
49 lines (41 loc) · 952 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
39
40
41
42
43
44
45
46
47
48
49
#ifndef _HEADER_H_
#define _HEADER_H_
#define BUF_SIZE 128
#define NIL (void*)-1
#include <stdbool.h>
typedef enum { BOOLEAN_t, VOID_t, INTEGER_t, FLOAT_t, STRING_t, \
VARIABLE_t, FUNCTION_t, PARAMETER_t } TYPE;
typedef enum {
ADD_t, SUB_t, MUL_t, DIV_t, MOD_t, INC_t, DEC_t,
LTE_t, MTE_t, LT_t, MT_t, EQ_t, NE_t,
ASGN_t, ADD_ASGN_t, SUB_ASGN_t, MUL_ASGN_t, DIV_ASGN_t, MOD_ASGN_t,
} OPERATOR;
struct TypeList {
char name[30];
TYPE type;
struct TypeList* next;
};
struct FuncAttr {
int paramNum;
struct TypeList* params;
};
struct SymNode {
char name[30];
int scope;
TYPE entry_type;
TYPE data_type;
int index;
struct SymNode* next;
bool isFuncDefine;
struct FuncAttr *attribute;
};
struct SymTable {
struct SymTable* next;
struct SymNode* first;
int localVarCount;
int scope;
int while_count;
int if_count;
int elif_count;
};
#endif