38 lines
694 B
C
38 lines
694 B
C
#ifndef INCLUDED_TERM_H
|
|
#define INCLUDED_TERM_H
|
|
|
|
#include "token.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef enum {
|
|
TYPE_VARIABLE,
|
|
TYPE_LAMBDA,
|
|
TYPE_APPLY,
|
|
} LambdaTermType;
|
|
|
|
typedef struct _LambdaTerm LambdaTerm;
|
|
struct _LambdaTerm {
|
|
LambdaTermType type;
|
|
union {
|
|
struct {
|
|
char *name;
|
|
size_t name_len;
|
|
} v;
|
|
struct {
|
|
char *arg;
|
|
size_t arg_len;
|
|
LambdaTerm *body;
|
|
} l;
|
|
struct {
|
|
LambdaTerm *func;
|
|
LambdaTerm *arg;
|
|
} a;
|
|
};
|
|
};
|
|
|
|
LambdaTerm *read_lambda_term(TokenStream *restrict stream,
|
|
ParseError *restrict err_out);
|
|
|
|
#endif
|