summaryrefslogtreecommitdiff
path: root/val.h
blob: 4560a1ca1e672ca6450ea6c5fc5c42fc5b7a12cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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