I am required to use Mathematica for a course I am taking, but prefer to use python for everything we are doing. I am interested in writing a program to turn my python scripts into Mathematica code that I can run and submit for the class. After doing some research, it seems like I'm trying to make a source-to-source compiler, something I have no experience with. Do you guys have any suggestions for literature/tutorials I should look at? Alternatively, if such a compiler already exists I would love to know.
-
2Unless you are accustomed to writing functional code in Python, this is unlikely to work well. Also, as a Python lover myself, let me suggest that you can learn to love Mma too (despite its TIMTOWTDI philosophy).Alan– Alan2017-09-08 00:54:17 +00:00Commented Sep 8, 2017 at 0:54
-
1this is too broad. give some specific example showing where you are having troubleagentp– agentp2017-09-08 10:06:30 +00:00Commented Sep 8, 2017 at 10:06
-
5Some things to think about: 1. While theoretically possible, such a source translator could never work well and would not be practically useful. Mathematica and Python are much too different. Mathematica doesn't do OOP and Python doesn't do term rewriting. 2. To create such a tool, you would need a much deeper knowledge of Mathematica than your course will require. What's the point of doing this again? To avoid learning/using Mathematica?? 3. Creating such tool would also likely take up much more of your time than your entire course.Szabolcs– Szabolcs2017-09-08 10:27:10 +00:00Commented Sep 8, 2017 at 10:27
Add a comment
|
1 Answer
I have written a translator that converts a small subset of Python into Mathematica. This translator also works with several other languages, such as JavaScript.