Decorated Attribute Grammars: Attribute Evaluation Meets Strategic Programming

  • Authors:
  • Lennart C. L. Kats;Anthony M. Sloane;Eelco Visser

  • Affiliations:
  • Software Engineering Research Group, Delft University of Technology, The Netherlands;Software Engineering Research Group, Delft University of Technology, The Netherlands and Department of Computing, Macquarie University, Sydney, Australia;Software Engineering Research Group, Delft University of Technology, The Netherlands

  • Venue:
  • CC '09 Proceedings of the 18th International Conference on Compiler Construction: Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Attribute grammars are a powerful specification formalism for tree-based computation, particularly for software language processing. Various extensions have been proposed to abstract over common patterns in attribute grammar specifications. These include various forms of copy rules to support non-local dependencies, collection attributes, and expressing dependencies that are evaluated to a fixed point. Rather than implementing extensions natively in an attribute evaluator, we propose attribute decorators that describe an abstract evaluation mechanism for attributes, making it possible to provide such extensions as part of a library of decorators. Inspired by strategic programming, decorators are specified using generic traversal operators. To demonstrate their effectiveness, we describe how to employ decorators in name, type, and flow analysis.