aboutsummaryrefslogtreecommitdiff
path: root/inc/parse.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/parse.h')
-rw-r--r--inc/parse.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/inc/parse.h b/inc/parse.h
new file mode 100644
index 0000000..dd25806
--- /dev/null
+++ b/inc/parse.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de>
+// SPDX-License-Identifier: MIT
+
+#ifndef CALM_PARSE_H
+#define CALM_PARSE_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;
+ union {
+ struct {
+ hash_t term;
+ } abs;
+ struct {
+ hash_t lhs;
+ hash_t rhs;
+ } app;
+ struct {
+ int index;
+ } var;
+ } u;
+};
+
+hash_t parse_blc(char **term);
+
+#endif