Parcourir la source

Enabled Taddeus' power match and rewrite rules.

Sander Mathijs van Veen il y a 14 ans
Parent
commit
eb26088931
1 fichiers modifiés avec 8 ajouts et 6 suppressions
  1. 8 6
      src/rules/__init__.py

+ 8 - 6
src/rules/__init__.py

@@ -1,12 +1,14 @@
-from ..node import OP_ADD, OP_MUL
+from ..node import OP_ADD, OP_MUL, OP_DIV, OP_POW
 from .poly import match_combine_polynomes, match_expand
+from .powers import match_add_exponents, match_subtract_exponents, \
+        match_multiply_exponents, match_duplicate_exponent, \
+        match_remove_negative_exponent, match_exponent_to_root
 
 
 RULES = {
         OP_ADD: [match_combine_polynomes],
-        OP_MUL: [match_expand],
-        #OP_MUL: [match_expand, match_add_exponents],
-        #OP_DIV: [match_subtract_exponents],
-        #OP_POW: [match_multiply_exponents, match_duplicate_exponent, \
-        #         match_remove_negative_exponent, match_exponent_to_root],
+        OP_MUL: [match_expand, match_add_exponents],
+        OP_DIV: [match_subtract_exponents],
+        OP_POW: [match_multiply_exponents, match_duplicate_exponent, \
+                 match_remove_negative_exponent, match_exponent_to_root],
         }