diff options
author | bd <bdunahu@operationnull.com> | 2025-01-28 16:22:49 -0500 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-01-28 16:22:49 -0500 |
commit | ce7189464a302872634d949cf06e9071b625bfcb (patch) | |
tree | adadc344f518642a009a2c12215e90bda420fc67 /src/frontend/parser.y | |
parent | 9e09767e23a4edb6b31540195bfe885f83e080d7 (diff) |
Fix various lexer/parser bugs, pass all tests for binary ops
Diffstat (limited to 'src/frontend/parser.y')
-rw-r--r-- | src/frontend/parser.y | 9 |
1 files changed, 4 insertions, 5 deletions
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); } - |