diff options
Diffstat (limited to 'inc/term.h')
-rw-r--r-- | inc/term.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/inc/term.h b/inc/term.h new file mode 100644 index 0000000..b64b106 --- /dev/null +++ b/inc/term.h @@ -0,0 +1,33 @@ +// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef CALM_TERM_H +#define CALM_TERM_H + +#include <lib/hash.h> + +typedef enum { INV, ABS, APP, VAR } term_type_t; + +struct term { + term_type_t type; + hash_t hash; + size_t refs; + size_t depth; + union { + struct { + struct term *term; + } abs; + struct { + struct term *lhs; + struct term *rhs; + } app; + struct { + int index; + } var; + } u; +}; + +struct term *term_new(term_type_t type, hash_t hash, size_t depth); +void term_refer(struct term *term, size_t depth); + +#endif |