void decls_prepend(char *ident, struct lambda *value)
{
- printf("add: %s\n", ident);
struct decllist *head = malloc(sizeof (struct decllist));
head->next = decls;
head->ident = ident;
struct lambda *decls_lookup(char *ident)
{
- printf("lookup: %s\n", ident);
struct decllist *c = decls;
while(c != NULL){
if(strcmp(c->ident, ident) == 0)
return copy(c->value);
c = c->next;
}
- printf("Notfound\n");
return make_ident(ident);
}
//If the first argument is an abstraction, we apply
t1 = t->data.application.expr1;
t2 = t->data.application.expr2;
- lambda_reduce(t1, total, maxdepth);
- lambda_reduce(t2, total, maxdepth);
if(t1->which == lambda_abs){
subst(t1->data.abstraction.ident, t1->data.abstraction.expr, t2, total);
(*maxdepth)--;
lambda_print(total);
lambda_reduce(t, total, maxdepth);
}
+ lambda_reduce(t1, total, maxdepth);
+ lambda_reduce(t, total, maxdepth);
break;
}
}