natural / java2python

Simple but effective library to translate Java source code to Python.
GNU Lesser General Public License v2.1
564 stars 243 forks source link

Any plans to make this run on Python 3 #67

Open hasii2011 opened 4 years ago

hasii2011 commented 4 years ago

Inquiring minds would like to know? :-)

adsharma commented 3 years ago

https://github.com/adsharma/java2python has antrl4+java9+python3.

I started with the grammar here:

https://github.com/antlr/grammars-v4/tree/master/java/java9

But switched to:

https://github.com/antlr/grammars-v4/tree/master/java/java

Much of it was running 2to3, downloading grammars and updating routine stuff. Now comes the hard part.

Java.g and JavaParser.g4 are not exactly the same. So j2py fails because of the differences. If anyone has made further progress on this, happy to collaborate.

adsharma commented 3 years ago

I found it easier to bootstrap a new project from scratch using antlr4-python3 and updated grammars. This one handles HelloWorld.java.

https://github.com/adsharma/decaf2many

MatthewTingum commented 2 years ago

Xrefing #66 #71 and #76 for the people coming from search engines.