Recently, I have crude translator from Mathematica input to Python, based on Robert Jacobson's FoxySheep. See
FoxySheep2
Mathematica "
InputForm" string input is parsed to an "
FullForm" parse tree, and then using that to convert to a Python AST. Finally a Python module is used to dump this to text.
However in order to do better translations, types for the parts of the AST would be helpful.
For example, in Mathematica:
{1, 2, 3} + 2
could be translated to Python as
[i + 2 for i in [1, 2, 3]]
And obviously not:
[1, 2, 3] + 2
I looked at annotate-ast and that seems in spirit what I want to use. However when I tried it, it seems focused on variables and call signatures, not expressions as are found above.
(Also, I'd hook into an API from Python rather than that command-line utility)
So my question is about to what extent this is being contemplated in this project. Should I should try extending this from the outside?
Any other thoughts?