From: Mart Lubbers Date: Wed, 23 May 2018 11:34:44 +0000 (+0200) Subject: change printing X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;ds=sidebyside;p=lambda.git change printing --- diff --git a/print.c b/print.c index 9e6280c..02fcc16 100644 --- a/print.c +++ b/print.c @@ -27,12 +27,19 @@ void term_print(struct lambda *t, struct lambda *mark) term_print(t, mark); break; case lambda_app: - putchar('('); + if(t->data.application.expr1->which == lambda_abs) + putchar('('); term_print(t->data.application.expr1, mark); if(t->data.application.expr1->which == lambda_abs) - printf(") ("); + putchar(')'); + + putchar(' '); + + if(t->data.application.expr2->which == lambda_abs) + putchar('('); term_print(t->data.application.expr2, mark); - putchar(')'); + if(t->data.application.expr2->which == lambda_abs) + putchar(')'); break; } if(t == mark) @@ -42,5 +49,5 @@ void term_print(struct lambda *t, struct lambda *mark) void lambda_print(struct lambda *t, struct lambda *mark) { term_print(t, mark); - printf("\n;"); + putchar('\n'); }