arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.00210cs.PL
收藏

CoCompiler:通过关系编译实现DSL提升

The CoCompiler: DSL Lifting via Relational Compilation

Galois, Inc.(Galois公司)

Naomi Spargo, Santiago Cuéllar, Jonathan Daugherty, Chris Phifer, David Darais

AI总结:

本研究提出CoCompiler双向工具,通过关系编译思路改写Vélus编译器,结合规范化处理,实现真实反应式C代码到Lustre DSL的提升,为复用现有编译器构建DSL提升器提供实用基础。

摘要:

将底层或遗留代码提升为领域特定语言(DSL)可提升我们对代码的理解能力,支持更深入的形式化推理,并便于安全修改。我们提出CoCompiler,这是一款双向编译器与提升工具,可在C语言与Lustre(一种用于反应式系统的同步数据流语言)之间转换。CoCompiler的核心洞见是:将编译器编写为关系而非传统函数,可“免费”获得DSL提升器。我们通过用Walrus关系编程语言改写已验证的Lustre到C编译器Vélus来实现这一思路,解决了我们所说的垂直提升问题,即将规范C代码转换为Lustre。为解决互补的水平问题——处理编译器映像之外的真实世界C代码,我们用Haskell应用了语义保持的规范化 pass。最终工具CoCompiler支持将真实反应式C代码提升为Lustre,并进一步转换为图形化行为模型。我们的方法具备模块化、语言无关且实现快速的特点,证明关系编程为复用现有编译器构建DSL提升器提供了实用基础。

英文摘要:

Lifting low-level or legacy code into a domain-specific language (DSL) improves our ability to understand it, enables deeper formal reasoning, and facilitates safe modification. We present the CoCompiler, a bidirectional compiler and lifter between C and Lustre, a synchronous dataflow language used for reactive systems. The key insight behind the CoCompiler is that writing a compiler as a relation, rather than as a traditional function, yields a DSL lifter "for free". We implement this idea by rewriting the verified Lustre-to-C compiler Vélus in the Walrus relational programming language. This solves what we call the vertical lifting problem, translating canonical C into Lustre. To address the complementary horizontal problem-handling real-world C outside the compiler's image-we apply semantic-preserving canonicalization passes in Haskell. The resulting tool, the CoCompiler, supports lifting real reactive C code into Lustre and onward into graphical behavioral models. Our approach is modular, language-agnostic, and fast to implement, demonstrating that relational programming offers a practical foundation for building DSL lifters by repurposing existing compilers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑