first evaluator draft
This commit is contained in:
parent
9fc5f10fc6
commit
2532dd9f4a
8 changed files with 399 additions and 43 deletions
19
main.c
19
main.c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue