{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,1,29]],"date-time":"2026-01-29T22:16:55Z","timestamp":1769725015365,"version":"3.49.0"},"reference-count":51,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA1","license":[{"start":{"date-parts":[[2023,4,6]],"date-time":"2023-04-06T00:00:00Z","timestamp":1680739200000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/501100001459","name":"Ministry of Education - Singapore","doi-asserted-by":"publisher","award":["251RES2023, MOE-T2EP20220-0014"],"award-info":[{"award-number":["251RES2023, MOE-T2EP20220-0014"]}],"id":[{"id":"10.13039\/501100001459","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2023,4,6]]},"abstract":"<jats:p>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, ease of exposition or maintainability, compatibility with external environment or analysis tools, 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. Users can rely on existing transpilation rules to translate most of the program correctly while focusing their effort locally, only on parts that are incorrect or need customization. This improves the correctness of the end result. 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 (both handcrafted and neural-based), while it produces readable code. We evaluate DuoGlot on two additional benchmarks, containing more challenging and longer programs, and similarly observe improved accuracy compared to the other transpilers.<\/jats:p>","DOI":"10.1145\/3586034","type":"journal-article","created":{"date-parts":[[2023,4,6]],"date-time":"2023-04-06T21:06:02Z","timestamp":1680815162000},"page":"201-229","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":9,"title":["User-Customizable Transpilation of Scripting Languages"],"prefix":"10.1145","volume":"7","author":[{"ORCID":"https:\/\/orcid.org\/0000-0003-1444-0237","authenticated-orcid":false,"given":"Bo","family":"Wang","sequence":"first","affiliation":[{"name":"National University of Singapore, Singapore"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-1792-4448","authenticated-orcid":false,"given":"Aashish","family":"Kolluri","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-9578-4837","authenticated-orcid":false,"given":"Ivica","family":"Nikoli\u0107","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-3655-9810","authenticated-orcid":false,"given":"Teodora","family":"Baluta","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1875-8675","authenticated-orcid":false,"given":"Prateek","family":"Saxena","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"320","published-online":{"date-parts":[[2023,4,6]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1002\/smr.4360040203"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1145\/1806799.1806840"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-73721-8_2"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1109\/MCSE.2010.118"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-662-44202-9_11"},{"key":"e_1_2_1_6_1","volume-title":"Advances in Neural Information Processing Systems","author":"Brown Tom","year":"1877","unstructured":"Tom Brown , Benjamin Mann , Nick Ryder , Melanie Subbiah , Jared D Kaplan , Prafulla Dhariwal , Arvind Neelakantan , Pranav Shyam , Girish Sastry , Amanda Askell , Sandhini Agarwal , Ariel Herbert-Voss , Gretchen Krueger , Tom Henighan , Rewon Child , Aditya Ramesh , Daniel Ziegler , Jeffrey Wu , Clemens Winter , Chris Hesse , Mark Chen , Eric Sigler , Mateusz Litwin , Scott Gray , Benjamin Chess , Jack Clark , Christopher Berner , Sam McCandlish , Alec Radford , Ilya Sutskever , and Dario Amodei . 2020. Language Models are Few-Shot Learners . In Advances in Neural Information Processing Systems , H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (Eds.). 33, Curran Associates, Inc. , 1877 \u20131901. https:\/\/proceedings.neurips.cc\/paper\/2020\/file\/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language Models are Few-Shot Learners. In Advances in Neural Information Processing Systems, H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (Eds.). 33, Curran Associates, Inc., 1877\u20131901. https:\/\/proceedings.neurips.cc\/paper\/2020\/file\/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf"},{"key":"e_1_2_1_7_1","unstructured":"Max Brunsfeld. 2018. Atom understands your code better than ever before. https:\/\/github.blog\/2018-10-31-atoms-new-parsing-system\/ \t\t\t\t  Max Brunsfeld. 2018. Atom understands your code better than ever before. https:\/\/github.blog\/2018-10-31-atoms-new-parsing-system\/"},{"key":"e_1_2_1_8_1","unstructured":"Trevor Burnham. 2015. Coffeescript: accelerated Javascript development. Pragmatic Bookshelf. https:\/\/pragprog.com\/titles\/tbcoffee2\/coffeescript\/ \t\t\t\t  Trevor Burnham. 2015. Coffeescript: accelerated Javascript development. Pragmatic Bookshelf. https:\/\/pragprog.com\/titles\/tbcoffee2\/coffeescript\/"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/1390630.1390647"},{"key":"e_1_2_1_10_1","volume-title":"Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, and Greg Brockman.","author":"Chen Mark","year":"2021","unstructured":"Mark Chen , Jerry Tworek , Heewoo Jun , Qiming Yuan , Henrique Ponde de Oliveira Pinto , Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, and Greg Brockman. 2021 . Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, https:\/\/doi.org\/10.48550\/arXiv.2107.03374 10.48550\/arXiv.2107.03374 Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, and Greg Brockman. 2021. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, https:\/\/doi.org\/10.48550\/arXiv.2107.03374"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSM.2013.85"},{"key":"e_1_2_1_12_1","unstructured":"Hubert Comon Max Dauchet R\u00e9mi Gilleron Florent Jacquemard Denis Lugiez Christof L\u00f6ding Sophie Tison and Marc Tommasi. 2008. Tree automata techniques and applications. https:\/\/hal.inria.fr\/hal-03367725 \t\t\t\t  Hubert Comon Max Dauchet R\u00e9mi Gilleron Florent Jacquemard Denis Lugiez Christof L\u00f6ding Sophie Tison and Marc Tommasi. 2008. Tree automata techniques and applications. https:\/\/hal.inria.fr\/hal-03367725"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2006.04.002"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICST.2017.28"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1145\/982962.964011"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/2786805.2786831"},{"key":"e_1_2_1_17_1","doi-asserted-by":"crossref","unstructured":"Google. 2021. TensorFlow 1.x vs TensorFlow 2 - Behaviors and APIs. https:\/\/www.tensorflow.org\/guide\/migrate\/tf1_vs_tf2 \t\t\t\t  Google. 2021. TensorFlow 1.x vs TensorFlow 2 - Behaviors and APIs. https:\/\/www.tensorflow.org\/guide\/migrate\/tf1_vs_tf2","DOI":"10.1007\/978-1-4842-6373-0_1"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1162\/coli.2008.07-051-R2-03-57"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1561\/2500000010"},{"key":"e_1_2_1_20_1","unstructured":"Anna Irrera. 2017. Banks scramble to fix old systems as IT \u2019cowboys\u2019 ride into sunset. https:\/\/www.reuters.com\/article\/us-usa-banks-cobol-idUSKBN17C0D8 \t\t\t\t  Anna Irrera. 2017. Banks scramble to fix old systems as IT \u2019cowboys\u2019 ride into sunset. https:\/\/www.reuters.com\/article\/us-usa-banks-cobol-idUSKBN17C0D8"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/3338906.3340459"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.1145\/2908080.2908117"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/2661136.2661148"},{"key":"e_1_2_1_24_1","unstructured":"Cody Koeninger. 2020. Cloudflare Workers Announces Broad Language Support. https:\/\/blog.cloudflare.com\/cloudflare-workers-announces-broad-language-support\/ \t\t\t\t  Cody Koeninger. 2020. Cloudflare Workers Announces Broad Language Support. https:\/\/blog.cloudflare.com\/cloudflare-workers-announces-broad-language-support\/"},{"key":"e_1_2_1_25_1","unstructured":"Vladimir I Levenshtein. 1966. Binary codes capable of correcting deletions insertions and reversals. In Soviet physics doklady. 10 707\u2013710. \t\t\t\t  Vladimir I Levenshtein. 1966. Binary codes capable of correcting deletions insertions and reversals. In Soviet physics doklady. 10 707\u2013710."},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/3527315"},{"key":"e_1_2_1_27_1","unstructured":"Gayle Laakmann McDowell. 2015. Cracking the coding interview: 189 programming questions and solutions. CareerCup LLC. isbn:9780984782857 \t\t\t\t  Gayle Laakmann McDowell. 2015. Cracking the coding interview: 189 programming questions and solutions. CareerCup LLC. isbn:9780984782857"},{"key":"e_1_2_1_28_1","unstructured":"MetaResearch. 2022. GeeksForGeeks benchmark. https:\/\/github.com\/facebookresearch\/CodeGen\/tree\/659963b195f5edaa42502d97605386b7fecbaa62\/data\/transcoder_evaluation_gfg \t\t\t\t  MetaResearch. 2022. GeeksForGeeks benchmark. https:\/\/github.com\/facebookresearch\/CodeGen\/tree\/659963b195f5edaa42502d97605386b7fecbaa62\/data\/transcoder_evaluation_gfg"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.1145\/3360569"},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.1145\/2491411.2494584"},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.1109\/ASE.2015.74"},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/2889160.2892661"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1002\/stvr.1576"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1109\/BLOCKS.2017.8120404"},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.is.2015.08.004"},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/2858965.2814310"},{"key":"e_1_2_1_37_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2017.44"},{"key":"e_1_2_1_38_1","first-page":"20601","article-title":"Unsupervised translation of programming languages","volume":"33","author":"Roziere Baptiste","year":"2020","unstructured":"Baptiste Roziere , Marie-Anne Lachaux , Lowik Chanussot , and Guillaume Lample . 2020 . Unsupervised translation of programming languages . Advances in Neural Information Processing Systems , 33 (2020), 20601 \u2013 20611 . https:\/\/proceedings.neurips.cc\/paper\/2020\/file\/ed23fbf18c2cd35f8c7f8de44f85c08d-Paper.pdf Baptiste Roziere, Marie-Anne Lachaux, Lowik Chanussot, and Guillaume Lample. 2020. Unsupervised translation of programming languages. Advances in Neural Information Processing Systems, 33 (2020), 20601\u201320611. https:\/\/proceedings.neurips.cc\/paper\/2020\/file\/ed23fbf18c2cd35f8c7f8de44f85c08d-Paper.pdf","journal-title":"Advances in Neural Information Processing Systems"},{"key":"#cr-split#-e_1_2_1_39_1.1","unstructured":"Baptiste Roziere Jie M Zhang Francois Charton Mark Harman Gabriel Synnaeve and Guillaume Lample. 2021. Leveraging Automated Unit Tests for Unsupervised Code Translation. arXiv preprint arXiv:2110.06773 https:\/\/doi.org\/10.48550\/arXiv.2110.06773 10.48550\/arXiv.2110.06773"},{"key":"#cr-split#-e_1_2_1_39_1.2","unstructured":"Baptiste Roziere Jie M Zhang Francois Charton Mark Harman Gabriel Synnaeve and Guillaume Lample. 2021. Leveraging Automated Unit Tests for Unsupervised Code Translation. arXiv preprint arXiv:2110.06773 https:\/\/doi.org\/10.48550\/arXiv.2110.06773"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1145\/3433210.3437528"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/230514.571645"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.1109\/52.895180"},{"key":"e_1_2_1_43_1","unstructured":"Guido van Rossum. 2009. What\u2019s New In Python 3.0. https:\/\/docs.python.org\/release\/3.0.1\/whatsnew\/3.0.html \t\t\t\t  Guido van Rossum. 2009. What\u2019s New In Python 3.0. https:\/\/docs.python.org\/release\/3.0.1\/whatsnew\/3.0.html"},{"key":"e_1_2_1_44_1","unstructured":"Guido van Rossum Pablo Galindo and Lysandros Nikolaou. 2020. PEP 617 \u2013 New PEG parser for CPython | peps.python.org. https:\/\/peps.python.org\/pep-0617\/ \t\t\t\t  Guido van Rossum Pablo Galindo and Lysandros Nikolaou. 2020. PEP 617 \u2013 New PEG parser for CPython | peps.python.org. https:\/\/peps.python.org\/pep-0617\/"},{"key":"e_1_2_1_45_1","unstructured":"Bo Wang. 2023. DuoGlot: A User-Customizable Code Translator. https:\/\/github.com\/HALOCORE\/DuoGlot \t\t\t\t  Bo Wang. 2023. DuoGlot: A User-Customizable Code Translator. https:\/\/github.com\/HALOCORE\/DuoGlot"},{"key":"e_1_2_1_46_1","doi-asserted-by":"publisher","DOI":"10.5281\/zenodo.7709003"},{"key":"e_1_2_1_47_1","volume-title":"The psychology of computer programming. 29","author":"Weinberg Gerald M","unstructured":"Gerald M Weinberg . 1971. The psychology of computer programming. 29 , Van Nostrand Reinhold New York . isbn:978-0-442-29264-5 Gerald M Weinberg. 1971. The psychology of computer programming. 29, Van Nostrand Reinhold New York. isbn:978-0-442-29264-5"},{"key":"e_1_2_1_48_1","doi-asserted-by":"publisher","DOI":"10.1017\/CBO9780511801303"},{"key":"e_1_2_1_49_1","unstructured":"Chen Xinyun Liu Chang and Song Dawn. 2018. Tree-to-tree neural networks for program translation. NeurIPS https:\/\/proceedings.neurips.cc\/paper\/2018\/file\/d759175de8ea5b1d9a2660e45554894f-Paper.pdf \t\t\t\t  Chen Xinyun Liu Chang and Song Dawn. 2018. Tree-to-tree neural networks for program translation. NeurIPS https:\/\/proceedings.neurips.cc\/paper\/2018\/file\/d759175de8ea5b1d9a2660e45554894f-Paper.pdf"},{"key":"e_1_2_1_50_1","doi-asserted-by":"publisher","DOI":"10.1109\/MSR.2019.00027"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3586034","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3586034","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T16:46:10Z","timestamp":1750178770000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3586034"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,4,6]]},"references-count":51,"journal-issue":{"issue":"OOPSLA1","published-print":{"date-parts":[[2023,4,6]]}},"alternative-id":["10.1145\/3586034"],"URL":"https:\/\/doi.org\/10.1145\/3586034","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,4,6]]},"assertion":[{"value":"2023-04-06","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}