压缩策略和属性文法
Zipping Strategies and Attribute Grammars
摘要:
策略项重写和属性文法是语言工程中广泛使用的两种强大的编程技术。前者依赖于在定义语言转换时应用术语重写规则的策略,而后者适合于表达上下文相关的语言处理算法。然而,这些技术中的每一种通常都是由其自身强大而庞大的语言处理器系统来实现的。因此,这使得这些系统更难扩展和组合。在本文中,我们提出了嵌入的战略树重写和属性语法的拉链为基础的,纯粹的功能设置。Zippers提供了一种简单但通用的树遍历机制,这是我们用来表达这两种技术的纯函数嵌入的构建块技术。将这两种技术嵌入到同一个环境中有几个优点:首先,我们可以轻松地组合/zip属性语法和策略,从而为语言工程师提供两个世界中最好的。其次,组合嵌入更容易维护和扩展,因为它是在简洁和统一的设置中编写的。这导致一个非常小的库,它能够表达高级(静态)分析和转换任务。我们展示了我们的库在优化Haskell let表达式,表达几个Haskell重构和解决LDTA工具挑战的几个语言处理任务中的表达能力。
英文摘要:
Strategic term rewriting and attribute grammars are two powerful programming techniques widely used in language engineering. The former, relies on strategies to apply term rewrite rules in defining language transformations, while the latter is suitable to express context-dependent language processing algorithms. Each of these techniques, however, is usually implemented by its own powerful and large language processor system. As a result, it makes such systems harder to extend and to combine. In this paper, we present the embedding of both strategic tree rewriting and attribute grammars in a zipper-based, purely functional setting. Zippers provide a simple, but generic tree-walk mechanism that is the building block technique we use to express the purely-functional embedding of both techniques. The embedding of the two techniques in the same setting has several advantages: First, we easily combine/zip attribute grammars and strategies, thus providing language engineers the best of the two worlds. Second, the combined embedding is easier to maintain and extend since it is written in a concise and uniform setting. This results in a very small library which is able to express advanced (static) analysis and transformation tasks. We show the expressive power of our library in optimizing Haskell let expressions, expressing several Haskell refactorings and solving several language processing tasks of the LDTA Tool Challenge.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。