aboutsummaryrefslogtreecommitdiff
path: root/inc/term.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/term.h')
-rw-r--r--inc/term.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/inc/term.h b/inc/term.h
new file mode 100644
index 0000000..9823fc1
--- /dev/null
+++ b/inc/term.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2024, Marvin Borner <dev@marvinborner.de>
+// SPDX-License-Identifier: MIT
+
+#ifndef BLOCADE_TERM_H
+#define BLOCADE_TERM_H
+
+#include <stddef.h>
+
+typedef enum { INV, ABS, APP, VAR, REF } term_type;
+
+struct term {
+ term_type type;
+ union {
+ struct {
+ struct term *term;
+ } abs;
+ struct {
+ struct term *lhs;
+ struct term *rhs;
+ } app;
+ struct {
+ int index;
+ } var;
+ struct {
+ size_t index;
+ } ref;
+ } u;
+};
+
+struct term *new_term(term_type type);
+void free_term(struct term *term);
+
+#endif