-
Notifications
You must be signed in to change notification settings - Fork 1
/
env.h
executable file
·45 lines (33 loc) · 945 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
38
39
40
41
42
43
44
45
/*Lab4: Your implementation of lab4*/
#ifndef __ENV_H_
#define __ENV_H_
#include "types.h"
#include "translate.h"
#include "temp.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;
};
typedef struct E_enventryList_ *E_enventryList;
struct E_enventryList_{
E_enventry e;
E_enventryList next;
};
typedef struct E_escapeEntry_ *E_escapeEntry;
struct E_escapeEntry_ {
int depth;
bool *escape;
};
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);
E_escapeEntry E_EscapeEntry(int d, bool *escape);
S_table E_base_tenv(void);
S_table E_base_venv(void);
#endif