LEGO-Compiler: Enhancing Neural Compilation Through Translation Composability

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Shuoming, Zhao, Jiacheng, Xia, Chunwei, Wang, Zheng, Chen, Yunji, Feng, Xiaobing, Cui, Huimin
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918035106824192
author Zhang, Shuoming
Zhao, Jiacheng
Xia, Chunwei
Wang, Zheng
Chen, Yunji
Feng, Xiaobing
Cui, Huimin
author_facet Zhang, Shuoming
Zhao, Jiacheng
Xia, Chunwei
Wang, Zheng
Chen, Yunji
Feng, Xiaobing
Cui, Huimin
contents Large language models (LLMs) have the potential to revolutionize how we design and implement compilers and code translation tools. However, existing LLMs struggle to handle long and complex programs. We introduce LEGO-Compiler, a novel neural compilation system that leverages LLMs to translate high-level languages into assembly code. Our approach centers on three key innovations: LEGO translation, which decomposes the input program into manageable blocks; breaking down the complex compilation process into smaller, simpler verifiable steps by organizing it as a verifiable LLM workflow by external tests; and a feedback mechanism for self-correction. Supported by formal proofs of translation composability, LEGO-Compiler demonstrates high accuracy on multiple datasets, including over 99% on ExeBench and 97.9% on industrial-grade AnsiBench. Additionally, LEGO-Compiler has also acheived near one order-of-magnitude improvement on compilable code size scalability. This work opens new avenues for applying LLMs to system-level tasks, complementing traditional compiler technologies.
format Preprint
id arxiv_https___arxiv_org_abs_2505_20356
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LEGO-Compiler: Enhancing Neural Compilation Through Translation Composability
Zhang, Shuoming
Zhao, Jiacheng
Xia, Chunwei
Wang, Zheng
Chen, Yunji
Feng, Xiaobing
Cui, Huimin
Programming Languages
Artificial Intelligence
Software Engineering
Large language models (LLMs) have the potential to revolutionize how we design and implement compilers and code translation tools. However, existing LLMs struggle to handle long and complex programs. We introduce LEGO-Compiler, a novel neural compilation system that leverages LLMs to translate high-level languages into assembly code. Our approach centers on three key innovations: LEGO translation, which decomposes the input program into manageable blocks; breaking down the complex compilation process into smaller, simpler verifiable steps by organizing it as a verifiable LLM workflow by external tests; and a feedback mechanism for self-correction. Supported by formal proofs of translation composability, LEGO-Compiler demonstrates high accuracy on multiple datasets, including over 99% on ExeBench and 97.9% on industrial-grade AnsiBench. Additionally, LEGO-Compiler has also acheived near one order-of-magnitude improvement on compilable code size scalability. This work opens new avenues for applying LLMs to system-level tasks, complementing traditional compiler technologies.
title LEGO-Compiler: Enhancing Neural Compilation Through Translation Composability
topic Programming Languages
Artificial Intelligence
Software Engineering
url https://arxiv.org/abs/2505.20356