Building Code Transpilers for Domain-Specific Languages Using Program Synthesis
Domain-specific languages (DSLs) are prevalent across many application domains. Such languages let developers easily express computations using high-level abstractions that result in performant implementations. To leverage DSLs, however, application developers need to master the DSL’s syntax and manually rewrite existing code. Compilers can aid in this effort, but part of building a compiler requires transpiling code from the source code to the target DSL. Such transpilation is typically done via pattern-matching rules on the source code. Sadly, developing such rules is often a painstaking and error-prone process.
In this paper, we describe our experience in using program synthesis to build code transpilers. To do so, we developed VerTrans, a new framework for building transpilers that transform general-purpose code into DSLs using program synthesis. To use VerTrans, transpiler developers first define the target DSL’s semantics using VerTrans’s specification language, and specify the search space for each input code fragment to be transpiled using VerTrans’s API. VerTrans then leverages program synthesizers and theorem provers to automatically find transpilations expressed in the target DSL that is provably semantic equivalent to the input code. We have used VerTrans to build two DSL transpilers targeting different programming models and application domains. Our results show that the VerTrans-based compilers can translate many benchmarks used in prior work created by specialized implementations, but can be built using orders-of-magnitude fewer lines of code as compared to prior work.
Thu 20 JulDisplayed time zone: Pacific Time (US & Canada) change
13:30 - 15:00 | ECOOP 5: SynthesisResearch Papers at Habib Classroom (Gates G01) Chair(s): Karine Even-Mendoza King’s College London | ||
13:30 15mTalk | Synthesis-Aided Crash Consistency for Storage Systems Research Papers Jacob Van Geffen Veridise Inc., James Bornholt University of Texas at Austin, Emina Torlak Amazon Web Services and University of Washington, Xi Wang University of Washington DOI | ||
13:45 15mTalk | Synthesizing Conjunctive Queries for Code Search Research Papers Chengpeng Wang Hong Kong University of Science and Technology, Peisen Yao Zhejing University, Wensheng Tang Hong Kong University of Science and Technology, Gang Fan Ant Group, Charles Zhang Hong Kong University of Science and Technology DOI | ||
14:00 15mTalk | Hoogle⋆: Constants and λ-abstractions in Petri-net-based Synthesis using Symbolic Execution Research Papers Henrique Botelho Guerra INESC-ID and IST, University of Lisbon, João F. Ferreira INESC-ID and IST, University of Lisbon, João Costa Seco NOVA-LINCS; Nova University of Lisbon DOI | ||
14:15 15mTalk | Building Code Transpilers for Domain-Specific Languages Using Program Synthesis Research Papers Sahil Bhatia University of California, Berkeley, Sumer Kohli UC Berkeley, Sanjit Seshia UC Berkeley, Alvin Cheung University of California at Berkeley DOI | ||
14:30 15mTalk | Do Machine Learning Models Produce TypeScript Types that Type Check? Research Papers DOI Media Attached File Attached | ||
14:45 15mTalk | Toward Tool-Independent Summaries for Symbolic Execution Research Papers Frederico Ramos Instituto Superior Técnico, Nuno Sabino Instituto Superior Técnico, Carnegie Mellon University, Pedro Adão IST-ULisboa and Instituto de Telecomunicações, David Naumann Stevens Institute of Technology, José Fragoso Santos INESC-ID/Instituto Superior Técnico, Portugal DOI |