aboutsummaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index a88a2f7..cf66f01 100644
--- a/src/term.c
+++ b/src/term.c
@@ -196,6 +196,29 @@ void print_term(struct term *term)
}
}
+void print_blc(struct term *term)
+{
+ switch (term->type) {
+ case ABS:
+ printf("00");
+ print_blc(term->u.abs.term);
+ break;
+ case APP:
+ printf("01");
+ print_blc(term->u.app.lhs);
+ print_blc(term->u.app.rhs);
+ break;
+ case VAR:
+ assert(term->u.var.type == BRUIJN_INDEX);
+ for (int i = 0; i <= term->u.var.name; i++)
+ printf("1");
+ printf("0");
+ break;
+ default:
+ fprintf(stderr, "Invalid type %d\n", term->type);
+ }
+}
+
void print_scheme(struct term *term)
{
switch (term->type) {