Python to JavaScript

Automatically translate Python programs to JavaScript

There are two research projects in this direction.

DuoGlot: A Rule-based system with Rule Synthesis

DuoGlot is a customizable code translator. Translation rules in DuoGlot are synthesized from user-provided code snippets. It iteratively explores possible translations given the provided translation rules until finding a translation that passes tests.

DuoGlot currently supports customized translation from Python to JavaScript for single-file standalone programs.

RuleSynth

Trans

TransMap: An LLM-based system that Pinpoint Translation Mistakes

TransMap is a tool to pinpoint mistakes in neural code translation by Codex or ChatGPT. More specifically, it focuses on Python to JavaScript code translation.

It takes a standalone Python program as input, and then obtains its JavaScript translation, and generates a source mapping between statements in the target program and the source program, using Codex or ChatGPT.

Next, TransMap uses source mapping to aid in tracing the execution of the translated program and comparing it against the source reference program to pinpoint the mistakes in the translation.

transmap