From abf68e0ad6c9f6d6cd14693894c609faca925e22 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 27 May 2023 10:07:24 +0200 Subject: Moved term logic --- inc/term.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 inc/term.h (limited to 'inc/term.h') 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 +// SPDX-License-Identifier: MIT + +#ifndef CALM_TERM_H +#define CALM_TERM_H + +#include + +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 -- cgit v1.2.3