From: Michael D. Lowis Date: Sun, 20 May 2018 01:07:06 +0000 (-0400) Subject: refactored X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=39ee229b41513136bc51cb59315cc10151dee9b2;p=proto%2Fsclpl.git refactored --- diff --git a/source/parser.c b/source/parser.c index a579a92..5b036eb 100644 --- a/source/parser.c +++ b/source/parser.c @@ -45,15 +45,14 @@ AST* toplevel(Parser* p) ret = definition(p); else error(p, "expressions are not allowed at the toplevel"); - //ret = expression(p); } return ret; } static AST* definition(Parser* p) { - Tok* id = expect(p, T_ID); AST* expr; + Tok* id = expect(p, T_ID); if (peek(p)->type == T_LPAR) { expr = function(p); } else { @@ -87,9 +86,8 @@ static AST* expression(Parser* p) expr = literal(p); } /* Check if this is a function application */ - if (peek(p)->type == T_LPAR) { + if (peek(p)->type == T_LPAR) expr = func_app(p, expr); - } return expr; }