Combinators for impure yet hygienic code generation

Combinators for impure yet hygienic code generation
复制标题

用于生成不纯净但卫生的代码的组合器

DOI:
10.1016/j.scico.2015.08.007
复制
发表时间:
2015
影响因子:
1.3
通讯作者:
Chung-chieh Shan
Chung-chieh Shan
中科院分区:
计算机科学4区
文献类型:
--
作者:
Yukiyoshi Kameyama;Oleg Kiselyov;Chung-chieh Shan

文献摘要

参考文献

被引文献

相似文献

代码生成是使高性能软件可重用的主要方法。在代码生成器中,无论是报告失败还是插入let语句和if-guards,效果都是必不可少的。大量痛苦的经验表明,不受限制的效果与生成的绑定器以不希望的方式相互作用,产生意外的未绑定变量,或者更糟的是,意外绑定变量。这些微妙之处阻碍了领域专家使用和扩展生成器。因此,一个紧迫的问题是表达所需的效果,同时调节它们,使生成的代码是正确的,或者至少是正确的范围内,通过construction.We提出了一个代码组合子框架,让我们表达任意的一元效果,包括可变引用和分隔控制,移动生成的绑定器之间的开放代码。我们的生成器表达式的静态类型不仅确保良好类型的生成器生成良好类型和良好作用域的代码。它们还表示生成的绑定器的词法作用域,并防止混淆具有不同作用域的变量。有史以来第一次,我们展示了静态安全和良好的范围循环交换和常量分解从任意嵌套的loops.Our框架实现为一个Haskell库,嵌入了一个可扩展的类型化高阶域特定语言。它可以被看作是“上演的Haskell”。为了变得实用,该库依赖于生成的类型环境上的高阶抽象语法和多态性,并且是用成熟语言编写的。
Code generation is the leading approach to making high-performance software reusable. Effects are indispensable in code generators, whether to report failures or to insert let-statements and if-guards. Extensive painful experience shows that unrestricted effects interact with generated binders in undesirable ways to produce unexpectedly unbound variables, or worse, unexpectedly bound ones. These subtleties hinder domain experts in using and extending the generator. A pressing problem is thus to express the desired effects while regulating them so that the generated code is correct, or at least correctly scoped, by construction.We present a code-combinator framework that lets us express arbitrary monadic effects, including mutable references and delimited control, that move open code across generated binders. The static types of our generator expressions not only ensure that a well-typed generator produces well-typed and well-scoped code. They also express the lexical scopes of generated binders and prevent mixing up variables with different scopes. For the first time ever we demonstrate statically safe and well-scoped loop exchange and constant factoring from arbitrarily nested loops.Our framework is implemented as a Haskell library that embeds an extensible typed higher-order domain-specific language. It may be regarded as `staged Haskell.' To become practical, the library relies on higher-order abstract syntax and polymorphism over generated type environments, and is written in the mature language.
使用仿函数和单子的多阶段编程:消除通用代码的抽象开销
DOI: 10.1007/11561347_18
发表时间: 2005
期刊: --
影响因子: --
作者:
J. Carette;O. Kiselyov
通讯作者: O. Kiselyov
重新审视名称和活页夹编程
DOI: 10.1145/1863543.1863575
发表时间: 2010
期刊: ACM SIGPLAN International Conference on Functional Programming
影响因子: --
作者:
N. Pouillard;F. Pottier
通讯作者: F. Pottier
通用和索引编程
DOI: 10.1007/978-3-642-32202-0
发表时间: 2012
期刊: --
影响因子: --
作者:
J. Gibbons
通讯作者: J. Gibbons
DOMain 特定类型错误诊断 (DOMSTED)
DOI: --
发表时间: 2014
期刊: --
影响因子: --
作者:
Jurriaan Hage
通讯作者: Jurriaan Hage
类型化无标签最终解释器
DOI: 10.1007/978-3-642-32202-0_3
发表时间: 2010
期刊: ArXiv
影响因子: --
作者:
O. Kiselyov
通讯作者: O. Kiselyov