aboutsummaryrefslogtreecommitdiff
path: root/inc/term.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/term.h')
-rw-r--r--inc/term.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/inc/term.h b/inc/term.h
new file mode 100644
index 0000000..78eb047
--- /dev/null
+++ b/inc/term.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2024, Marvin Borner <dev@marvinborner.de>
+// SPDX-License-Identifier: MIT
+
+#ifndef TERM_H
+#define TERM_H
+
+#include <stddef.h>
+
+typedef enum { INV, ABS, APP, IDX } TermType;
+
+typedef struct term {
+ TermType type;
+ union {
+ struct {
+ struct term *body;
+ } abs;
+ struct {
+ struct term *lhs;
+ struct term *rhs;
+ } app;
+ size_t index;
+ } u;
+} Term;
+
+struct term *term_new(TermType type);
+void term_free(Term *term);
+void term_diff(Term *a, Term *b);
+
+#endif