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
dd369030
Commit
dd369030
authored
Feb 28, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of kompiler.org:trs
parents
b6bd65db
dd5f8afc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
TODO
TODO
+20
-0
src/strategy.py
src/strategy.py
+3
-2
tests/test_leiden_oefenopgave.py
tests/test_leiden_oefenopgave.py
+8
-4
No files found.
TODO
View file @
dd369030
# vim: set fileencoding=utf-8 :
- Fix BisonSyntaxError location tracking.
- Fix BisonSyntaxError location tracking.
- Sort polynom by its exponents?
- Sort polynom by its exponents?
...
@@ -70,6 +72,24 @@ Division of 0 by 1 reduces to 0.
...
@@ -70,6 +72,24 @@ Division of 0 by 1 reduces to 0.
>>> @
>>> @
2 / 7 + 4 / 11
2 / 7 + 4 / 11
- Cancel terms before multiplying constants: (3 * ...) / (3 * ...) -> ... / ...
>>> (7/3)*(3/5)
7 / 3 * (3 / 5)
>>> ??
Expand fraction with nominator greater than denominator 7 / 3 to an integer
plus a fraction.
Multiply fractions 7 / 3 and 3 / 5.
>>> @
7 * 3 / (3 * 5)
>>> ?
Multiply constant 7 with 3.
>>> @
21 / (3 * 5)
>>> @
21 / 15
>>> @
7 / 5
- filter_duplicates does not seem to work anymore...
- filter_duplicates does not seem to work anymore...
- Fix error while parsing unicode PI:
- Fix error while parsing unicode PI:
...
...
src/strategy.py
View file @
dd369030
from
rules.sort
import
move_constant
from
rules.sort
import
move_constant
from
rules.numerics
import
reduce_fraction_constants
from
rules.numerics
import
reduce_fraction_constants
,
fraction_to_int_fraction
def
pick_suggestion
(
possibilities
):
def
pick_suggestion
(
possibilities
):
...
@@ -8,7 +8,8 @@ def pick_suggestion(possibilities):
...
@@ -8,7 +8,8 @@ def pick_suggestion(possibilities):
# TODO: pick the best suggestion.
# TODO: pick the best suggestion.
for
suggestion
,
p
in
enumerate
(
possibilities
+
[
None
]):
for
suggestion
,
p
in
enumerate
(
possibilities
+
[
None
]):
if
p
and
p
.
handler
not
in
[
move_constant
,
reduce_fraction_constants
]:
if
p
and
p
.
handler
not
in
[
move_constant
,
fraction_to_int_fraction
,
reduce_fraction_constants
]:
break
break
if
not
p
:
if
not
p
:
...
...
tests/test_leiden_oefenopgave.py
View file @
dd369030
...
@@ -143,14 +143,18 @@ class TestLeidenOefenopgave(TestCase):
...
@@ -143,14 +143,18 @@ class TestLeidenOefenopgave(TestCase):
self
.
assertRewrite
([
'2/7 - 4/11'
,
'22 / 77 - 28 / 77'
,
self
.
assertRewrite
([
'2/7 - 4/11'
,
'22 / 77 - 28 / 77'
,
'(22 - 28) / 77'
,
'-6 / 77'
])
'(22 - 28) / 77'
,
'-6 / 77'
])
#def test_4_3(self):
def
test_4_3
(
self
):
# self.assertRewrite(['(7/3) * (3/5)', '7 / 5'])
self
.
assertRewrite
([
'(7/3) * (3/5)'
,
'7 * 3 / (3 * 5)'
,
'21 / (3 * 5)'
,
'21 / 15'
,
'7 / 5'
])
#def test_4_4(self):
#def test_4_4(self):
# self.assertRewrite(['(3/4) / (5/6)', '9 / 10'])
# self.assertRewrite(['(3/4) / (5/6)', '9 / 10'])
#
def test_4_5(self):
def
test_4_5
(
self
):
# self.assertRewrite(['1/4 * 1/x',
'1 / (4x)'])
self
.
assertRewrite
([
'1/4 * 1/x'
,
'1 / 4 / x'
,
])
# FIXME:
'1 / (4x)'])
#def test_4_6(self):
#def test_4_6(self):
# self.assertRewrite(['(3/x^2) / (x/7)', '21 / x^3'])
# self.assertRewrite(['(3/x^2) / (x/7)', '21 / x^3'])
...
...
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