From ce7189464a302872634d949cf06e9071b625bfcb Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 28 Jan 2025 16:22:49 -0500 Subject: Fix various lexer/parser bugs, pass all tests for binary ops --- src/frontend/parser.y | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/frontend/parser.y') diff --git a/src/frontend/parser.y b/src/frontend/parser.y index aa58f64..bd5d127 100644 --- a/src/frontend/parser.y +++ b/src/frontend/parser.y @@ -66,10 +66,6 @@ exp: term { add_child($$, $1); add_child($$, $3); } -| un_op exp { - $$ = create_expr($1); - add_child($$, $2); - } ; term: factor { @@ -90,6 +86,10 @@ term: factor { add_child($$, $1); add_child($$, $3); } +| un_op exp { + $$ = create_expr($1); + add_child($$, $2); + } ; factor: NUMBER { @@ -113,4 +113,3 @@ un_op: COMP { void yyerror(Node **root, const char *msg) { printf("** Line %d: %s\n", yylineno, msg); } - -- cgit v1.2.3