Implement atom evaluation
This commit is contained in:
19
lib/eval.c
Normal file
19
lib/eval.c
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user