UUAG meets AspectAG: how to make attribute grammars first-class

  • Authors:
  • Marcos Viera;Doaitse Swierstra;Arie Middelkoop

  • Affiliations:
  • Universidad de la República, Montevideo, Uruguay;Utrecht University, Utrecht, The Netherlands;Utrecht University, Utrecht, The Netherlands

  • Venue:
  • Proceedings of the Twelfth Workshop on Language Descriptions, Tools, and Applications
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

The Utrecht University Attribute Grammar Compiler takes attribute grammar declarations from multiple source files and generates an attribute grammar evaluator consisting of a single Haskell source text. The problem with such generative approaches is that, once the code is generated and compiled, neither new attributes can be introduced nor existing ones can be modified without providing access to all the source code and without having to regenerate and recompile the entire program. In contrast to this textual approach we recently constructed the Haskell combinator library AspectAG with which one can construct attribute grammar fragments as a Haskell value. Such descriptions can be individually type-checked, compiled, distributed and composed to construct a compiler. This method however results in rather inefficient compilers, due to the costs incurred by the increased flexibility. We show how to combine the two approaches by generating AspectAG code fragments from UUAGC sources, thus making it possible to trade between efficiency and flexibility; besides enabling a couple of optimizations for AspectAG resulting in a considerable speed improvement this makes existing UUAGC code reusable in a flexible environment.