I am looking for open source implementations of python compilers written purely in Java, preferably those that support Python 3. I started with jython but it only supports Python 2.7. Thanks!
Asked
Active
Viewed 228 times
1 Answers
2
I don't believe such a thing exists yet. If it does its in pre-alpha and probably isn't stable or well documented. Jython is probably still your best bet, and apparently support for Python 3 is coming to Jython but the timetable is still unclear. See this stack overflow question for more on the subject.
However one advantage of Jython is that you can use any Java classes as if they were Python modules. What features were you planning on using that are only supported by Python 3? Because it is entirely possible (and actually very likely) that you can reproduce those features using Python 2.7, Java or a combo of the two.
-
Thanks. Can you edit the link? (it got messed up) I'm mostly looking for a parser and simply error checking passes (if they exist), and I am just too lazy to roll out my own ASTs :) – JRR Apr 09 '16 at 06:16
-
Updated. Sorry about that. – MS-DDOS Apr 09 '16 at 06:18
-
If you're just looking to error check your python, I certainly don't blame you for not wanting to roll your own AST (sounds like a nightmare). Have you considered simply attempting to compile the code to a .pyc? Obviously won't be any runtime consideration but you can do this using the python 'compileall' module. I can give you an example if you think it'd be useful. – MS-DDOS Apr 09 '16 at 06:25
-
I'm actually hoping to reuse the compiler frontend to implement my own code analysis. Thanks for the link anyways. – JRR Apr 09 '16 at 18:26
-
No worries, hope it was a helpful answer. – MS-DDOS Apr 09 '16 at 23:03