Strategic tree rewriting in attribute grammars

Lucas Kramer, Eric Van Wyk

Research output: Chapter in Book/Report/Conference proceedingConference contribution

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 if a 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.

Original languageEnglish (US)
Title of host publicationSLE 2020 - Proceedings of the 13th ACM SIGPLAN International Conference on Software Language Engineering, Co-located with SPLASH 2020
EditorsRalf Lammel, Laurence Tratt, Juan de Lara
PublisherAssociation for Computing Machinery, Inc
Pages210-229
Number of pages20
ISBN (Electronic)9781450381765
DOIs
StatePublished - Nov 16 2020
Event13th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2020, co-located with SPLASH 2020 - Virtual, Online, United States
Duration: Nov 16 2020Nov 17 2020

Publication series

NameSLE 2020 - Proceedings of the 13th ACM SIGPLAN International Conference on Software Language Engineering, Co-located with SPLASH 2020

Conference

Conference13th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2020, co-located with SPLASH 2020
CountryUnited States
CityVirtual, Online
Period11/16/2011/17/20

Bibliographical note

Publisher Copyright:
© 2020 ACM.

Keywords

  • attribute grammars
  • term rewriting

Fingerprint Dive into the research topics of 'Strategic tree rewriting in attribute grammars'. Together they form a unique fingerprint.

Cite this