TODO 2.6 KB

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