TODO 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. - Fix BisonSyntaxError location tracking.
  2. - Sort polynom by its exponents?
  3. - No possibilities found for:
  4. >>> a2b3 + a2b3
  5. a ^ 2 * b ^ 3 + a ^ 2 * b ^ 3
  6. - 2 + 3 + 4 rewrites to 5 instead of 5 + 4
  7. -> the problem is that the 'root' of the application is actually a subtree
  8. of the entire expression. This means that the parent of each possibility
  9. root (or 'subtree') must me stored to be able to replace the subtree.
  10. - MESSAGES needs to be expanded.
  11. - rewrite match_combine_polynomes to an even more generic form:
  12. match_combine_factors.
  13. - "--ab + c" has no rewrite possibility. The graph of "--ab + c" is also
  14. not valid:
  15. -
  16. +
  17. ╭─┴╮
  18. * c
  19. ╭┴╮
  20. - b
  21. a
  22. - The following expression gives a cycle in the possibilities:
  23. >>> ab + ba
  24. possibilities:
  25. Group "ab" is multiplied by 1 and 1, combine them.
  26. >>> (1 + 1) * ab
  27. (1 + 1)ab
  28. possibilities:
  29. Combine the constants 1 and 1.
  30. Group "1" is multiplied by 1 and 1, combine them.
  31. Expand a(1 + 1).
  32. Expand b(1 + 1).
  33. - Fix division by zero caused by "0/0".
  34. smvv@multivac ~/work/trs $ printf "a/0\n??" | ./main.py
  35. Traceback (most recent call last):
  36. File "./main.py", line 75, in <module>
  37. main()
  38. File "./main.py", line 64, in main
  39. node = p.run(debug=args.debug)
  40. File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
  41. self.report_last_error(filename, e)
  42. File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
  43. self.engine.runEngine(debug)
  44. File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
  45. File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
  46. possibilities = handler(retval)
  47. File "/home/smvv/work/trs/src/rules/fractions.py", line 23, in match_constant_division
  48. raise ZeroDivisionError('Division by zero: %s.' % node)
  49. ZeroDivisionError: Division by zero: a / 0.
  50. smvv@multivac ~/work/trs $ printf "0/0\n??" | ./main.py
  51. Traceback (most recent call last):
  52. File "./main.py", line 75, in <module>
  53. main()
  54. File "./main.py", line 64, in main
  55. node = p.run(debug=args.debug)
  56. File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 258, in run
  57. self.report_last_error(filename, e)
  58. File "/home/smvv/work/trs/external/pybison/src/python/bison.py", line 251, in run
  59. self.engine.runEngine(debug)
  60. File "bison_.pyx", line 592, in bison_.ParserEngine.runEngine (build/external/pybison/bison_.c:592)
  61. File "/home/smvv/work/trs/src/parser.py", line 195, in hook_handler
  62. possibilities = handler(retval)
  63. File "/home/smvv/work/trs/src/rules/numerics.py", line 73, in match_divide_numerics
  64. divide = not divmod(n.value, dv)[1]
  65. ZeroDivisionError: integer division or modulo by zero
  66. - Last possibilities reduce to a similar result.
  67. smvv@multivac ~/work/trs $ printf "0/1\n??" | ./main.py
  68. <Possibility root="0 / 1" handler=divide_numerics args=(0, 1)>
  69. Division of 0 by 1 reduces to 0.
  70. Division of 0 by 1 reduces to 0.