Support multiargument lambda's
authorMart Lubbers <mart@martlubbers.net>
Wed, 16 May 2018 12:00:12 +0000 (14:00 +0200)
committerMart Lubbers <mart@martlubbers.net>
Wed, 16 May 2018 12:00:12 +0000 (14:00 +0200)
lambda.y

index e65a644..830fa99 100644 (file)
--- a/lambda.y
+++ b/lambda.y
@@ -101,10 +101,15 @@ appterm
                        $$ = make_ident($1->data.identifier);
                        lambda_free($1);
                }
-       | LAMBDA IDENT DOT term
+       | LAMBDA abstraction
+               { $$ = $2; }
+       | OBRACE term CBRACE
+               { $$ = $2; }
+abstraction
+       : IDENT abstraction
                {
-                       $$ = make_abstraction($2->data.identifier, $4);
-                       lambda_free($2);
+                       $$ = make_abstraction($1->data.identifier, $2);
+                       lambda_free($1);
                }
-       | OBRACE term CBRACE
+       | DOT term
                { $$ = $2; }