summaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/dat.h b/dat.h
index f2e7e81..b5f6f4f 100644
--- a/dat.h
+++ b/dat.h
@@ -1,3 +1,6 @@
+#define PrecedenceLevels 1200
+
+typedef struct Operator Operator;
typedef struct Term Term;
typedef struct Binding Binding;
typedef struct Goal Goal;
@@ -7,6 +10,14 @@ typedef struct Predicate Predicate;
typedef struct Module Module;
typedef int (*Builtin)(Term *, Binding **, Module *);
+struct Operator
+{
+ int type;
+ int level;
+ Rune *spelling;
+ Operator *next;
+};
+
struct Term
{
int tag;
@@ -70,9 +81,21 @@ struct Module
/* What about imports */
Rune *name;
Predicate *predicates;
+ Operator *operators[PrecedenceLevels];
Module *next;
};
+/* Operator types */
+enum {
+ Xf = 1<<0, /* 1 */
+ Yf = 1<<1, /* 2 */
+ Xfx = 1<<2, /* 4 */
+ Xfy = 1<<3, /* 8 */
+ Yfx = 1<<4, /* 16 */
+ Fy = 1<<5, /* 32 */
+ Fx = 1<<6, /* 64 */
+};
+
/* Sorted so that a lower value means it comes earlier in the standard ordering */
enum {
VariableTerm,