first evaluator draft

This commit is contained in:
Lobo 2026-01-07 09:40:21 -03:00
parent 9fc5f10fc6
commit 2532dd9f4a
8 changed files with 399 additions and 43 deletions

19
main.c
View file

@ -1,15 +1,22 @@
#include <stdio.h>
#include "wscm.h"
int main(void) {
gcinit();
const S *hello = intern("hello", -1);
const S *goodbye = intern("goodbye", -1);
O p = cons(BOX(hello), BOX(goodbye));
addroot(&p);
O env = NIL;
addroot(&env);
setupenv(&env);
collect();
println(p);
// IF
O code = cons(SYM("if"), cons(NIL, cons(NUM(100), cons(NUM(200), NIL))));
addroot(&code);
// collect();
println(code);
printf("=> ");
println(eval(code, env));
gcfinalize();
return 0;