User-Customizable Transpilation of Scripting Languages

01/26/2023
by   Bo Wang, et al.
0

A transpiler converts code from one programming language to another. Many practical uses of transpilers require the user to be able to guide or customize the program produced from a given input program. This customizability is important for satisfying many application-specific goals for the produced code such as ensuring performance, readability, maintainability, compatibility, and so on. Conventional transpilers are deterministic rule-driven systems often written without offering customizability per user and per program. Recent advances in transpilers based on neural networks offer some customizability to users, e.g. through interactive prompts, but they are still difficult to precisely control the production of a desired output. Both conventional and neural transpilation also suffer from the "last mile" problem: they produce correct code on average, i.e., on most parts of a given program, but not necessarily for all parts of it. We propose a new transpilation approach that offers fine-grained customizability and reusability of transpilation rules created by others, without burdening the user to understand the global semantics of the given source program. Our approach is mostly automatic and incremental, i.e., constructs translation rules needed to transpile the given program as per the user's guidance piece-by-piece. We implement the transpiler as a tool called DuoGlot, which translates Python to Javascript programs, and evaluate it on the popular GeeksForGeeks benchmarks. DuoGlot achieves 90 translation accuracy and so it outperforms all existing translators, while it produces readable code. We evaluate DuoGlot on two additional benchmarks, containing more challenging and longer programs, and similarly observe improved accuracy.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/25/2018

Translating C programs to MSVL programs

C language is one of the most popular languages in system programming an...
research
11/21/2022

Programming by Example and Text-to-Code Translation for Conversational Code Generation

Dialogue systems is an increasingly popular task of natural language pro...
research
09/29/2022

I Speak, You Verify: Toward Trustworthy Neural Program Synthesis

We develop an approach for improving the trustworthiness and overall acc...
research
08/25/2018

Translating Xd-C programs to MSVL programs

C language is one of the most popular languages for software systems. In...
research
09/10/2021

Solver-based Gradual Type Migration

Gradually typed languages allow programmers to mix statically and dynami...
research
03/29/2021

Dynamic Binary Translation for SGX Enclaves

Enclaves, such as those enabled by Intel SGX, offer a hardware primitive...
research
02/17/2023

PAC Prediction Sets for Large Language Models of Code

Prediction sets have recently been shown to be a promising strategy for ...

Please sign up or login with your details

Forgot password? Click here to reset