| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- - Fix BisonSyntaxError location tracking.
- - Sort polynom by its exponents?
- - No possibilities found for:
- >>> a2b3 + a2b3
- a ^ 2 * b ^ 3 + a ^ 2 * b ^ 3
- - 2 + 3 + 4 rewrites to 5 instead of 5 + 4
- -> the problem is that the 'root' of the application is actually a subtree
- of the entire expression. This means that the parent of each possibility
- root (or 'subtree') must me stored to be able to replace the subtree.
- - MESSAGES needs to be expanded.
- - rewrite match_combine_polynomes to an even more generic form:
- match_combine_factors.
- - "--ab + c" has no rewrite possibility. The graph of "--ab + c" is also
- not valid:
- -
- │
- +
- ╭─┴╮
- * c
- ╭┴╮
- - b
- │
- a
- - The following expression gives a cycle in the possibilities:
- >>> ab + ba
- possibilities:
- Group "ab" is multiplied by 1 and 1, combine them.
- >>> (1 + 1) * ab
- (1 + 1)ab
- possibilities:
- Combine the constants 1 and 1.
- Group "1" is multiplied by 1 and 1, combine them.
- Expand a(1 + 1).
- Expand b(1 + 1).
- - Fix division by zero caused by "0/0".
- smvv@multivac ~/work/trs $ printf "a/0\n??" | ./main.py
- Traceback (most recent call last):
- File "./main.py", line 75, in <module>
- main()
- File "./main.py", line 64, in main
- node = p.run(debug=args.debug)
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
- self.report_last_error(filename, e)
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
- self.engine.runEngine(debug)
- File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
- File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
- possibilities = handler(retval)
- File "/home/smvv/work/trs/src/rules/fractions.py", line 23, in match_constant_division
- raise ZeroDivisionError('Division by zero: %s.' % node)
- ZeroDivisionError: Division by zero: a / 0.
- smvv@multivac ~/work/trs $ printf "0/0\n??" | ./main.py
- Traceback (most recent call last):
- File "./main.py", line 75, in <module>
- main()
- File "./main.py", line 64, in main
- node = p.run(debug=args.debug)
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
- self.report_last_error(filename, e)
- File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
- self.engine.runEngine(debug)
- File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
- File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
- possibilities = handler(retval)
- File "/home/smvv/work/trs/src/rules/numerics.py", line 73, in match_divide_numerics
- divide = not divmod(n.value, dv)[1]
- ZeroDivisionError: integer division or modulo by zero
- - Last possibilities reduce to a similar result.
- smvv@multivac ~/work/trs $ printf "0/1\n??" | ./main.py
- <Possibility root="0 / 1" handler=divide_numerics args=(0, 1)>
- Division of 0 by 1 reduces to 0.
- Division of 0 by 1 reduces to 0.
- - Should powers have a higher precedence thatn negation while printing?
- the current situation: -(x ^ 2) and -x ^ 2 (the latter instead of (-x) ^ 2)
- might be desired: -x ^ 2 instead of -(x ^ 2), and explicit parentheses for
- (-x) ^ 2
|