diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/lib/hash.h (renamed from inc/hash.h) | 4 | ||||
-rw-r--r-- | inc/lib/hashmap.h (renamed from inc/hashmap.h) | 4 | ||||
-rw-r--r-- | inc/log.h | 4 | ||||
-rw-r--r-- | inc/map.h | 14 | ||||
-rw-r--r-- | inc/parse.h | 31 |
5 files changed, 51 insertions, 6 deletions
diff --git a/inc/hash.h b/inc/lib/hash.h index f0bb468..88b9215 100644 --- a/inc/hash.h +++ b/inc/lib/hash.h @@ -1,8 +1,8 @@ // Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> // SPDX-License-Identifier: MIT -#ifndef BLOC_HASH_H -#define BLOC_HASH_H +#ifndef CALM_HASH_H +#define CALM_HASH_H #include <stdint.h> #include <stddef.h> diff --git a/inc/hashmap.h b/inc/lib/hashmap.h index b13b815..809ddca 100644 --- a/inc/hashmap.h +++ b/inc/lib/hashmap.h @@ -3,8 +3,8 @@ // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. -#ifndef HASHMAP_H -#define HASHMAP_H +#ifndef CALM_HASHMAP_H +#define CALM_HASHMAP_H #include <stdbool.h> #include <stddef.h> @@ -1,8 +1,8 @@ // Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> // SPDX-License-Identifier: MIT -#ifndef BLOC_LOG_H -#define BLOC_LOG_H +#ifndef CALM_LOG_H +#define CALM_LOG_H void debug(const char *format, ...); void debug_enable(int enable); diff --git a/inc/map.h b/inc/map.h new file mode 100644 index 0000000..427cee5 --- /dev/null +++ b/inc/map.h @@ -0,0 +1,14 @@ +// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef CALM_MAP_H +#define CALM_MAP_H + +#include <lib/hash.h> + +struct term *map_get(hash_t hash); +void map_set(struct term *term, hash_t hash); +void map_initialize(void); +void map_destroy(void); + +#endif 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 |