2020-05-10 13:51:33 -04:00
|
|
|
#ifndef ENVIRONMENT_H
|
|
|
|
#define ENVIRONMENT_H
|
|
|
|
|
|
|
|
#include "object.h"
|
|
|
|
|
|
|
|
struct Environment;
|
|
|
|
struct Environment {
|
2022-01-07 16:55:03 -05:00
|
|
|
char** strings;
|
|
|
|
Object* objects;
|
|
|
|
struct Environment* outer;
|
|
|
|
int size;
|
2020-05-10 13:51:33 -04:00
|
|
|
};
|
|
|
|
|
2022-01-07 16:55:03 -05:00
|
|
|
Object fetchFromEnvironment(const char* name, struct Environment* env);
|
|
|
|
|
|
|
|
struct Environment envForLambda(const Object* params, const Object* arg_forms,
|
|
|
|
struct Environment* outer);
|
|
|
|
|
|
|
|
void addToEnv(struct Environment* env, const char* name, const Object obj);
|
|
|
|
|
|
|
|
void printEnv(struct Environment* env);
|
|
|
|
|
|
|
|
void addFunc(const char* name,
|
|
|
|
Object (* func)(Object, Object, struct Environment*),
|
|
|
|
struct Environment* env);
|
|
|
|
|
|
|
|
void deleteEnv(struct Environment* e);
|
|
|
|
|
2020-05-10 13:51:33 -04:00
|
|
|
struct Environment defaultEnv();
|
|
|
|
|
|
|
|
#endif
|