summaryrefslogtreecommitdiff
path: root/val.c
diff options
context:
space:
mode:
Diffstat (limited to 'val.c')
-rw-r--r--val.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/val.c b/val.c
new file mode 100644
index 0000000..4456148
--- /dev/null
+++ b/val.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include "val.h"
+
+void print_val(Val v) {
+ switch (v.ty) {
+ case TY_NIL:
+ printf("nil\n");
+ break;
+ case TY_NUM:
+ printf("%f\n",AS_NUM(v));
+ break;
+ case TY_BOOL:
+ printf("%s\n",AS_BOOL(v) ? "true" : "false");
+ break;
+ }
+}