Surfacing Program Structure with Auxiliary Signals for Low-Resource Code Translation

Federico Ranaldi, Nickil Maveli, Shay B. Cohen, Fabio Massimo Zanzotto


Abstract
LLMs are extremely good code translators, except when it matters most: translating from low-resource to high-resource programming languages. The reason may lie in the fact that code translation relies on superficial lexical cues rather than on exploiting the deeper, language-agnostic program structure. We propose BoJac (Bohm–Jacopini), a novel commenting approach that pushes LLMs to exploit program structure by verbalizing structured programming principles in a guided natural language format. By using structure, BoJac enhances the ability to translate low-resource to-high-resource code. Using equivalent code benchmarks across multiple language pairs, we compare BoJac against several forms of auxIliary guidance provided alongside the source code: synthetic free-form chain-of comments, abstract syntax tree, and I/O Traces. To disentangle structural understanding from identifier-level matching, we repeat all experiments under name mangling and extend the same comparison to LoRA Fine-tuning on signal-augmented training sets. Our results show that the strongest gains come from auxiliary signals expressed in natural language, particularly when they explicitly encode structural and computational-level properties of the source code as in BoJac. While purely structural representations appear less effective, hybrid approaches such as BoJac, which convey structural and paradigm-level information through formalised natural language, emerge as a promising direction.
Anthology ID:
2026.emnlp-main.2234
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
50850–50867
Language:
URL:
https://aclanthology.org/2026.emnlp-main.2234/
DOI:
Bibkey:
Cite (ACL):
Federico Ranaldi, Nickil Maveli, Shay B. Cohen, and Fabio Massimo Zanzotto. 2026. Surfacing Program Structure with Auxiliary Signals for Low-Resource Code Translation. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 50850–50867, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Surfacing Program Structure with Auxiliary Signals for Low-Resource Code Translation (Ranaldi et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.2234.pdf