repositories
/
lambda.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6c92ed
)
change printing
master
author
Mart Lubbers
<mart@martlubbers.net>
Wed, 23 May 2018 11:34:44 +0000
(13:34 +0200)
committer
Mart Lubbers
<mart@martlubbers.net>
Wed, 23 May 2018 11:34:44 +0000
(13:34 +0200)
print.c
patch
|
blob
|
history
diff --git
a/print.c
b/print.c
index
9e6280c
..
02fcc16
100644
(file)
--- 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:
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)
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);
term_print(t->data.application.expr2, mark);
- putchar(')');
+ if(t->data.application.expr2->which == lambda_abs)
+ putchar(')');
break;
}
if(t == mark)
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);
void lambda_print(struct lambda *t, struct lambda *mark)
{
term_print(t, mark);
- p
rintf("\n;"
);
+ p
utchar('\n'
);
}
}