aboutsummaryrefslogtreecommitdiff
path: root/inc/term.h
blob: 78eb0479a32675d7e1d39fc234662950e71b886d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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