We present a type system for strategy languages that express program transformations as compositions of rewrite rules. Our row-polymorphic type system assists compiler engineers to write correct strategies by statically rejecting non meaningful compositions of rewrites that otherwise would fail during rewriting at runtime. Furthermore, our type system enables reasoning about how rewriting transforms the shape of the computational program. We present a formalization of our language at its type system and demonstrate its practical use for expressing compiler optimization strategies. Our type system builds the foundation for many interesting future applications, including verifying the correctness of program transformations and synthesizing program transformations from specifications encoded as types.
翻译:我们提出了一种战略语言类型系统,将程序转换作为重写规则的构成来表示。我们的行式多变型系统协助编译员工程师以静态方式拒绝在运行时重写时会失败的无实际意义的重写组成来编写正确的战略。此外,我们的类型系统可以解释重写如何改变计算程序形状。我们将我们的语言形式化,并展示其用于表达编译器优化战略的实际用途。我们的类型系统为许多有趣的未来应用奠定了基础,包括核查程序转换的正确性以及将程序转换从编码为类型的规格中综合出来的程序转换。