diff --git a/Makefile b/Makefile index 45695887..dabf4361 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build run build: - gcc -o bin/picrin -I./include src/main.c src/state.c + gcc -o bin/picrin -I./include src/main.c src/state.c src/gc.c clean: rm bin/picrin diff --git a/include/picrin/value.h b/include/picrin/value.h index 0ee56e30..86146585 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -2,6 +2,7 @@ #define VALUE_H__ enum pic_vtype { + PIC_VTYPE_NIL, PIC_VTYPE_HEAP }; @@ -35,6 +36,7 @@ struct pic_symbol { char *name; }; +pic_value pic_nil_value(); pic_value pic_obj_value(struct pic_object *obj); #endif diff --git a/src/value.c b/src/value.c index 778d2bc9..1c60e3ce 100644 --- a/src/value.c +++ b/src/value.c @@ -1,5 +1,15 @@ #include "picrin.h" +pic_value +pic_nil_value() +{ + pic_value v; + + v.vtype = PIC_VTYPE_NIL; + v.u.data = NULL; + return v; +} + pic_value pic_obj_value(struct pic_object *obj) {