-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.h
37 lines (30 loc) · 805 Bytes
/
env.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
/*Lab4: Your implementation of lab4*/
#ifndef ENV_H_
#define ENV_H_
#include "temp.h"
#include "translate.h"
#include "types.h"
typedef struct E_enventry_ *E_enventry;
struct E_enventry_ {
enum { E_varEntry, E_funEntry } kind;
int readonly; // for loop var
union {
struct {
Tr_access access;
Ty_ty ty;
} var;
struct {
Tr_level level;
Temp_label label;
Ty_tyList formals;
Ty_ty result;
} fun;
} u;
};
E_enventry E_VarEntry(Tr_access access, Ty_ty ty);
E_enventry E_ROVarEntry(Tr_access access, Ty_ty ty);
E_enventry E_FunEntry(Tr_level level, Temp_label label, Ty_tyList formals,
Ty_ty result);
S_table E_base_tenv(void);
S_table E_base_venv(void);
#endif