Version 4 (modified by wouter, 2 years ago) ( diff )

--

Java to Python (j2p)

This tool can translate java programs into python programs. This is a complex mechanism and still somewhat experimental. It can translate both single file java programs as multi-file projects.

There are a number of packages inside this project, because this translator has a modular setup:

package name= artifactiddescriptioncurrent state
coretranslation of java programs + library containing translators for a few basic java classesgeneral translation pretty complete; library translators very partial
jackson-tlibrary with translators for jackson->pyson translationquite complete
tudutils-tlibrary with translators for tudelft utilities package.very partial

These modules offer translation support for external java libraries. For instance jackson is an external library to translate json to java; the jackson-t library translates jackson-based code and annotations into pyson-based python code.

You can easily extend the standard core translator with these plugin translators by just importing these plugins in your java project. Just make sure that they are all based on the same core version.

Internal mechanism

There are two main components in the core:

  1. The translator that parses java code and creates equivalent python code
  2. per-java-class translators that know how to translate a specific call to a java class function or field into equivalent python code.

The first is generic and used for all java programs. It is currently pretty complete but details will be filled in over time as the need arises to support more java syntax.

The second is currently very partial. The reason is that there are a huge number of java classes, and every field and function in it will need a specialized translator. This will grow slowly over time as needed.

Note: See TracWiki for help on using the wiki.