From 4bb8773d5d189b6dca871d843d2bd05341360492 Mon Sep 17 00:00:00 2001 From: Eatswap Date: Mon, 12 Dec 2022 23:17:49 +0800 Subject: [PATCH] fix: allow return from if, allow empty function arg list --- DragonLisp.y | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DragonLisp.y b/DragonLisp.y index d8cc574..4af39e3 100644 --- a/DragonLisp.y +++ b/DragonLisp.y @@ -248,8 +248,8 @@ list-tokens ; S-Expr-if - : IF R-Value R-Value R-Value { std::printf("Parsed S-Expr-if -> IF R-Value R-Value R-Value\n"); } - | IF R-Value R-Value { std::printf("Parsed S-Expr-if -> IF R-Value R-Value\n"); } + : IF R-Value func-body-expr func-body-expr { std::printf("Parsed S-Expr-if -> IF R-Value func-body-expr func-body-expr\n"); } + | IF R-Value func-body-expr { std::printf("Parsed S-Expr-if -> IF R-Value func-body-expr\n"); } ; S-Expr-loop @@ -273,6 +273,7 @@ identifier-list S-Expr-func-call : IDENTIFIER R-Value-list { std::printf("Parsed S-Expr-func-call -> IDENTIFIER R-Value-list\n"); } + | IDENTIFIER { std::printf("Parsed S-Expr-func-call -> IDENTIFIER\n"); } ; %%