-
Notifications
You must be signed in to change notification settings - Fork 1
/
environment.h
37 lines (27 loc) · 1.03 KB
/
environment.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
#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
#include "stmt.h"
#include "interpreter.h"
typedef struct Record{
char *name;
Object object;
struct Record* next;
} Record;
typedef struct Environment{
Record *front;
Record *rear;
struct Environment *parent;
} Environment;
Environment *env_new(Environment *parent);
void env_free(Environment *env);
void env_put(char *identifer, int line, Object value, Environment *env);
Object env_get(char *identifer, int line, Environment *env);
void env_arr_new(char *identifer, int line, long numElements, Environment *env);
void env_arr_put(char *identifer, int line, long index, Object value, Environment *env);
Object env_arr_get(char *identifer, int line, long index, Environment *env);
void env_routine_put(Routine r, int line, Environment *env);
Routine env_routine_get(char *identifer, int line, Environment *env);
void env_container_put(Container c, int line, Environment *env);
Container env_container_get(char *identifer, int line, Environment *env);
void gc_obj(Object o);
#endif