From 97bc549d4b8bf638946ac4ff3b066941bca9a03b Mon Sep 17 00:00:00 2001 From: rodri Date: Thu, 5 Sep 2024 15:45:27 +0000 Subject: initial compiler work. --- dat.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 dat.h (limited to 'dat.h') diff --git a/dat.h b/dat.h new file mode 100644 index 0000000..052270f --- /dev/null +++ b/dat.h @@ -0,0 +1,47 @@ +enum +{ + TDOUBLE, + TPOINT, + TVECTOR, + TNORMAL, + TQUAT, +}; + +typedef struct Var Var; +typedef struct Symbol Symbol; +typedef struct Const Const; +typedef struct Builtin Builtin; + +struct Var +{ + int type; + union { + double dval; + Point3 pval; + Quaternion qval; + }; +}; + +struct Symbol +{ + char *name; + int type; + union { + Var var; + double val; /* constant value */ + double (*fn)(double); + } u; + Symbol *next; +}; + +struct Const +{ + char *name; + double val; +}; + +struct Builtin +{ + char *name; + double (*fn)(); +}; -- cgit v1.2.3