diff options
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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) { |