diff options
author | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-06-30 17:03:25 +0000 |
---|---|---|
committer | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-06-30 17:03:25 +0000 |
commit | 50f83a91220940042962fdb55d07bb03991f52be (patch) | |
tree | c2d1046393d7c3f75becd7b2150afab46156baf0 /dat.h | |
parent | 347e5bc533070a5e988d82e7588a4e905c7096f3 (diff) |
Add support for builtins, and implement true/0, fail/0, call/1, and !/0 builtins
Diffstat (limited to 'dat.h')
-rw-r--r-- | dat.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1,5 +1,8 @@ typedef struct Term Term; typedef struct Binding Binding; +typedef struct Goal Goal; +typedef struct Choicepoint Choicepoint; +typedef int (*Builtin)(Term *, Term *, Goal **, Choicepoint **, Binding **); struct Term { @@ -23,6 +26,20 @@ struct Binding Binding *next; }; +struct Goal +{ + Term *goal; + Goal *next; +}; + +struct Choicepoint +{ + Goal *goalstack; + Term *retryclause; + uvlong id; /* Unique number for each clause. Used to know where to cut to. */ + Choicepoint *next; +}; + enum { CompoundTerm, AtomTerm, |