blob: a090afbecf7480e20da45822083222de1457affd (
plain) (
blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
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
{
int tag;
Rune *text;
int arity;
Term *next;
Term *children;
int numbertype;
vlong ival;
double dval;
uvlong clausenr;
};
struct Binding
{
Rune *name;
uvlong nr; /* Unique number for each clause. Every time a clause is used, it gets a new number. */
Term *value;
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,
VariableTerm,
NumberTerm,
StringTerm,
};
enum {
NumberInt,
NumberFloat,
};
int debug;
Term *initgoals;
|