lambda-calc-1/environment/new.c
2025-01-13 20:36:07 -06:00

33 lines
542 B
C

#include <debug.h>
#include <extern/avl/avl.h>
#include <memory/smalloc.h>
#include "variable/compare.h"
#include "variable/free.h"
#include "inc.h"
#include "struct.h"
#include "new.h"
struct environment* new_environment(
struct environment* fallback)
{
ENTER;
struct environment* this = smalloc(sizeof(*this));
this->fallback = inc_environment(fallback);
this->tree = avl_alloc_tree(
compare_variables,
free_variable);
this->refcount = 1;
EXIT;
return this;
}