Commit 6a78440d authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed some precedence issues.

parent f1f8aaea
...@@ -294,6 +294,13 @@ class Parser(BisonParser): ...@@ -294,6 +294,13 @@ class Parser(BisonParser):
while self.possibilities: while self.possibilities:
# Find the first implicit possibliity in the list # Find the first implicit possibliity in the list
# FIXME: Is it smart to apply a rule that is not a hint? # FIXME: Is it smart to apply a rule that is not a hint?
# ANSWER: Yes, but there must be an extra list that prevents
# deliberately generated implicit rules from being applied
#sugg = self.possibilities[0]
#if sugg.handler not in IMPLICIT_RULES:
# break
sugg = None sugg = None
for pos in self.possibilities: for pos in self.possibilities:
......
...@@ -7,7 +7,8 @@ from .logarithmic import factor_in_exponent_multiplicant, \ ...@@ -7,7 +7,8 @@ from .logarithmic import factor_in_exponent_multiplicant, \
from .derivatives import chain_rule from .derivatives import chain_rule
from .negation import double_negation, negated_factor, negated_nominator, \ from .negation import double_negation, negated_factor, negated_nominator, \
negated_denominator, negated_zero negated_denominator, negated_zero
from .fractions import multiply_with_fraction, extract_fraction_terms from .fractions import multiply_with_fraction, extract_fraction_terms, \
add_nominators
from .integrals import factor_out_constant, integrate_variable_root from .integrals import factor_out_constant, integrate_variable_root
from .powers import remove_power_of_one from .powers import remove_power_of_one
from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority
...@@ -18,6 +19,9 @@ from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority ...@@ -18,6 +19,9 @@ from .sqrt import quadrant_sqrt, extract_sqrt_mult_priority
# means lower priority # means lower priority
HIGH = [ HIGH = [
raised_base, raised_base,
# 4 / 4 + 1 / 4 -> 5 / 4 instead of 1 + 1/4
add_nominators,
] ]
...@@ -32,7 +36,7 @@ LOW = [ ...@@ -32,7 +36,7 @@ LOW = [
# Fucntion precedences relative to eachother. Tuple (A, B) means that A has a # Fucntion precedences relative to eachother. Tuple (A, B) means that A has a
# higer priority than B. This list ignores occurences in the HIGH or LOW lists # higher priority than B. This list ignores occurences in the HIGH or LOW lists
# above # above
RELATIVE = [ RELATIVE = [
# Precedences needed for 'power rule' # Precedences needed for 'power rule'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment