summaryrefslogtreecommitdiff
path: root/val.h
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-07-29 22:22:23 +0100
committerubq323 <ubq323@ubq323.website>2023-07-29 22:22:23 +0100
commitc83618999227adb5e745f92205bd48e076e2d124 (patch)
treeebd862d08180fb49bdec90b553b21c89c43467fb /val.h
parentf9f7b92fdda17efe2dca455d6f641a424a97b2db (diff)
th
Diffstat (limited to 'val.h')
-rw-r--r--val.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/val.h b/val.h
new file mode 100644
index 0000000..4560a1c
--- /dev/null
+++ b/val.h
@@ -0,0 +1,39 @@
+#ifndef _val_h
+#define _val_h
+
+#include <stdbool.h>
+
+struct _val;
+typedef struct _val Val;
+struct _obj;
+typedef struct _obj Obj;
+
+
+typedef enum {
+ TY_NUM,
+ TY_BOOL,
+ TY_NIL,
+} ValTy;
+
+struct _val {
+ ValTy ty;
+ union {
+ double d;
+ bool b;
+ Obj *o;
+ } as;
+};
+
+struct _obj {
+ // some gc shit
+ int foo;
+};
+
+
+#define IS_NUM(x) (x.ty == TY_NUM)
+#define IS_BOOL(x) (x.ty == TY_BOOL)
+#define IS_NIL(x) (x.ty == NIL)
+
+
+
+#endif