arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.03777cs.PLcs.SE
收藏

从独立编译到可靠的语言组成

Statically Verifying Well-Definedness of Separately Compiled Attribute Grammars

Università degli Studi di Milano(米兰大学)

Federico Bruzzone, Walter Cazzola, Luca Favalli

AI总结:

本文提出nlgcheck,一种基于数据流分析的静态分析工具,用于解决Neverlang工作台中独立编译下的属性文法管理问题,提升编译时正确性与运行时鲁棒性。

摘要:

编程语言的发展涉及复杂的理论和实践挑战,尤其是在通过语言扩展实现模块化和可重用性时。虽然语言工作台旨在在语言扩展问题的约束下实现模块化开发,但一个关键约束——独立编译——往往由于其复杂性而被放宽。然而,这种放宽会破坏可重用性和与常见依赖系统的集成。在独立编译下,管理属性文法是一个关键难题,因为扩展可能会引入新的属性,从而破坏之前生成的抽象语法树结构。现有的方法,如Neverlang工作台中使用动态映射,虽然在灵活性方面有所优势,但牺牲了编译时的正确性,导致潜在的运行时错误。本文通过引入nlgcheck,一种基于数据流分析的理论上严谨的静态分析工具,用于Neverlang语言工作台,来解决这一问题。nlgcheck能够在编译时检测潜在的运行时错误——如未定义属性访问——从而在保持独立编译的同时,维护强静态正确性保证。通过使用突变测试对基于Neverlang的项目进行实验评估,结果表明,nlgcheck有效增强了鲁棒性,而不会牺牲模块化或灵活性,并且性能水平不会妨碍其在日常开发活动中的采用。

英文摘要:

The development of programming languages involves complex theoretical and practical challenges, particularly when addressing modularity and reusability through language extensions. While language workbenches aim to enable modular development under the constraints of the language extension problem, one critical constraint--separate compilation--is often relaxed due to its complexity. However, this relaxation undermines artifact reusability and integration with common dependency systems. A key difficulty under separate compilation arises from managing attribute grammars, as extensions may introduce new attributes that invalidate previously generated abstract syntax tree structures. Existing approaches, such as the use of dynamic maps in the Neverlang workbench, favor flexibility at the cost of compile-time correctness, leading to potential runtime errors due to undefined attributes. This work addresses this issue by introducing nlgcheck, a theoretically sound static analysis tool based on data-flow analysis for the Neverlang language workbench, which detects potential runtime errors--such as undefined attribute accesses--when separately compiled language components are composed, before the resulting language is ever run, thus preserving separate compilation while maintaining strong static correctness guarantees. Experimental evaluation using mutation testing on Neverlang-based projects demonstrates that nlgcheck effectively enhances robustness without sacrificing modularity or flexibility and with a level of performance that does not impede its adoption in daily development activities.

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

↑