Strategic Term Rewriting in Attribute Grammars [conference paper]

Conference

13th ACM SIGPLAN International Conference on Software Language Engineering (SLE) - November 15, 2020

Authors

Lucas Kramer (Ph.D. student), Eric Van Wyk (associate professor)

Abstract

This paper presents strategy attributes, a seamless integration of strategic term rewriting into attribute grammars. Strategy attributes are specified using rewrite rules with strategies that control their application. The rules can reference contextual information held in attributes on the trees being rewritten. This use of attributes leads to rewriting on decorated trees instead of undecorated terms. During rewriting, attributes are (lazily) computed on new trees to ensure they are correct with respect to their defining equations. Attributes and strategic rewriting can each be used where most appropriate, thus avoiding the cumbersome aspects of each.

Strategy attributes are essentially higher-order attributes for which the defining equations are automatically generated from the attributes’ strategy expressions. They are thus compatible with other attribute grammar features such as reference attributes, forwarding, and attribute flow analyses for well-definedness. A conservative static analysis checks ifa strategy is intended to always succeed or to be partial, thus simplifying its use and optimizing its translation. Strategy attributes are demonstrated in the optimization of a simple expression language, evaluation of the lambda calculus, and optimization of strategy attribute translations.

Link to full paper

Strategic Term Rewriting in Attribute Grammars

Keywords

software engineering, attribute grammars, term rewriting