#include <stddef.h>

typedef struct slice {
	char   *start;
	size_t  len;
	size_t  indentation;
} slice_t;

typedef slice_t ident_t;
typedef slice_t type_t;

typedef void (*callback)(void*);

typedef struct expr {
	callback print;
	callback eval;
	char payload[0];
} expr_t;

typedef struct decl {
	ident_t  name;
	type_t  *type;
	expr_t  *expr;
} decl_t;

char* str_of_slice(slice_t);

/* expr constructors */
expr_t* mk_app(expr_t*, expr_t*);
expr_t* mk_lam(ident_t*, expr_t*);
expr_t* mk_let(ident_t*, expr_t*, expr_t*);
expr_t* mk_var(ident_t*);
expr_t* mk_annot(expr_t*, type_t*);
expr_t* mk_lit_int(ident_t*);
expr_t* mk_lit_float(ident_t*);
expr_t* mk_lit_char(ident_t*);
expr_t* mk_lit_str(ident_t*);
