diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/log.h | 11 | ||||
-rw-r--r-- | inc/parse.h | 14 | ||||
-rw-r--r-- | inc/print.h | 12 | ||||
-rw-r--r-- | inc/term.h | 29 |
4 files changed, 66 insertions, 0 deletions
diff --git a/inc/log.h b/inc/log.h new file mode 100644 index 0000000..5910305 --- /dev/null +++ b/inc/log.h @@ -0,0 +1,11 @@ +// Copyright (c) 2024, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef LOG_H +#define LOG_H + +void debug(const char *format, ...); +void debug_enable(int enable); +void fatal(const char *format, ...) __attribute__((noreturn)); + +#endif diff --git a/inc/parse.h b/inc/parse.h new file mode 100644 index 0000000..f44fd50 --- /dev/null +++ b/inc/parse.h @@ -0,0 +1,14 @@ +// Copyright (c) 2024, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef PARSE_H +#define PARSE_H + +#include <stdio.h> + +#include <term.h> + +Term *parse_blc_fp(FILE *fp); +Term *parse_blc(const char **term); + +#endif diff --git a/inc/print.h b/inc/print.h new file mode 100644 index 0000000..e2f7aa2 --- /dev/null +++ b/inc/print.h @@ -0,0 +1,12 @@ +// Copyright (c) 2024, Marvin Borner <dev@marvinborner.de> +// SPDX-License-Identifier: MIT + +#ifndef PRINT_H +#define PRINT_H + +#include <term.h> + +void print_bruijn(Term *term); +void print_blc(Term *term); + +#endif 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 |