Skip to content

Added binary op and set & op precedence back to 11 (same as the table) #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ RUN(NAME expr_01 LABELS cpython llvm c)
RUN(NAME expr_02 LABELS cpython llvm c)
RUN(NAME expr_03 LABELS cpython llvm c)
RUN(NAME expr_04 LABELS cpython llvm c)
RUN(NAME expr_05 LABELS cpython llvm)
RUN(NAME expr_05 LABELS cpython llvm c)
RUN(NAME expr_06 LABELS cpython llvm c)
RUN(NAME expr_07 LABELS cpython llvm)
RUN(NAME expr_08 LABELS llvm c)
Expand Down
6 changes: 5 additions & 1 deletion src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ R"(#include <stdio.h>
case (ASR::binopType::Sub) : { last_expr_precedence = 6; break; }
case (ASR::binopType::Mul) : { last_expr_precedence = 5; break; }
case (ASR::binopType::Div) : { last_expr_precedence = 5; break; }
case (ASR::binopType::BitAnd) : { last_expr_precedence = 5; break; }
case (ASR::binopType::BitAnd) : { last_expr_precedence = 11; break; }
case (ASR::binopType::BitOr) : { last_expr_precedence = 13; break; }
case (ASR::binopType::BitXor) : { last_expr_precedence = 12; break; }
case (ASR::binopType::BitLShift) : { last_expr_precedence = 7; break; }
case (ASR::binopType::BitRShift) : { last_expr_precedence = 7; break; }
case (ASR::binopType::Pow) : {
src = "pow(" + left + ", " + right + ")";
if (is_c) {
Expand Down