diff --git a/ASTNode.cpp b/ASTNode.cpp index a24445310..1de26b63f 100644 --- a/ASTNode.cpp +++ b/ASTNode.cpp @@ -34,7 +34,7 @@ const char* ASTBinary::op_str() const ".", " ** ", " * ", " / ", " // ", " % ", " + ", " - ", " << ", " >> ", " & ", " ^ ", " | ", " and ", " or ", " += ", " -= ", " *= ", " /= ", " %= ", " **= ", " <<= ", - " >>= ", " &= ", " ^= ", " |= ", " //= " + " >>= ", " &= ", " ^= ", " |= ", " //= ", " @ ", " @= ", }; return s_op_strings[op()]; } diff --git a/ASTNode.h b/ASTNode.h index 63783df9d..b2bec1903 100644 --- a/ASTNode.h +++ b/ASTNode.h @@ -96,7 +96,7 @@ class ASTBinary : public ASTNode { BIN_OR, BIN_LOG_AND, BIN_LOG_OR, BIN_IP_ADD, BIN_IP_SUBTRACT, BIN_IP_MULTIPLY, BIN_IP_DIVIDE, BIN_IP_MODULO, BIN_IP_POWER, BIN_IP_LSHIFT, BIN_IP_RSHIFT, BIN_IP_AND, BIN_IP_XOR, BIN_IP_OR, - BIN_IP_FLOOR, + BIN_IP_FLOOR, BIN_MAT_MULTIPLY, BIN_IP_MAT_MULTIPLY, }; ASTBinary(PycRef left, PycRef right, int op, diff --git a/ASTree.cpp b/ASTree.cpp index 5969235df..d9f35f742 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -231,6 +231,14 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) stack.push(new ASTBinary(left, right, ASTBinary::BIN_XOR)); } break; + case Pyc::BINARY_MATRIX_MULTIPLY: + { + PycRef right = stack.top(); + stack.pop(); + PycRef left = stack.top(); + stack.pop(); + stack.push(new ASTBinary(left, right, ASTBinary::BIN_MAT_MULTIPLY)); + } case Pyc::BREAK_LOOP: curblock->append(new ASTKeyword(ASTKeyword::KW_BREAK)); break; @@ -906,6 +914,15 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) stack.push(new ASTBinary(left, right, ASTBinary::BIN_IP_XOR)); } break; + case Pyc::INPLACE_MATRIX_MULTIPLY: + { + PycRef right = stack.top(); + stack.pop(); + PycRef left = stack.top(); + stack.pop(); + stack.push(new ASTBinary(left, right, ASTBinary::BIN_IP_MAT_MULTIPLY)); + } + break; case Pyc::JUMP_IF_FALSE_A: case Pyc::JUMP_IF_TRUE_A: case Pyc::JUMP_IF_FALSE_OR_POP_A: diff --git a/tests/35_matrix_mult_oper.pyc b/tests/35_matrix_mult_oper.pyc new file mode 100644 index 000000000..d79abb43f Binary files /dev/null and b/tests/35_matrix_mult_oper.pyc differ