Implement atom evaluation

This commit is contained in:
2025-08-10 13:55:20 +01:00
parent 03bd0ff597
commit 3f871d2b43
5 changed files with 95 additions and 0 deletions

19
lib/eval.c Normal file
View File

@@ -0,0 +1,19 @@
#include "eval.h"
#include "env.h"
#include <assert.h>
void eval(am_t *am)
{
assert(am->expr->is_atom);
switch (am->expr->atom.type) {
case ATOM_TYPE_EMPTY_LIST:
case ATOM_TYPE_INTEGER:
am->val = am->expr;
break;
case ATOM_TYPE_SYMBOL:
env_fetch(am);
break;
}
}