blob: fe4b6b8d2bbfb79526ce971a0fadc9dc065d2cf0 (
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
|
// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de>
// SPDX-License-Identifier: MIT
#ifndef SHARING_TERM_H
#define SHARING_TERM_H
#include <stddef.h>
#include <lib/hash.h>
#include <lib/queue.h>
typedef enum { INV, ABS, APP, VAR } term_type_t;
struct term_handle {
struct term *term;
hash_t hash;
};
struct term {
term_type_t type;
hash_t hash;
struct term *canonic;
char building;
struct queue *queue;
struct list *parents;
struct list *neighbours;
union {
struct {
struct term *term;
} abs;
struct {
struct term *lhs;
struct term *rhs;
} app;
struct {
size_t index;
} var;
} u;
};
struct term *term_new(term_type_t type, hash_t hash);
void term_free(struct term *term);
void term_print(struct term *term);
#endif
|