Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
6a78440d
Commit
6a78440d
authored
May 02, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some precedence issues.
parent
f1f8aaea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
src/parser.py
src/parser.py
+7
-0
src/rules/precedences.py
src/rules/precedences.py
+6
-2
No files found.
src/parser.py
View file @
6a78440d
...
@@ -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:
...
...
src/rules/precedences.py
View file @
6a78440d
...
@@ -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
# hig
h
er 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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment