WG211/M7Sloane

From WG 2.11
Jump to: navigation, search


A Pure Object-Oriented Embedding of Attribute Grammars

Anthony Sloane

Macquarie University

(joint work with Lennart Kats and Eelco Visser, TU Delft)

Attribute grammars are a powerful specification paradigm for many language processing tasks, particularly semantic analysis of programming languages. Recent attribute grammar systems use dynamic scheduling algorithms to evaluate attributes by need. In this talk, we show how to remove the need for a generator, by embedding a dynamic approach in a modern, object-oriented programming language to implement a small, lightweight attribute grammar library. The Kiama attribution library has similar features to current generators, including cached, uncached, circular, higher-order and parameterised attributes, and implements new techniques for dynamic extension and variation of attribute equations. We use the Scala programming language because of its combination of object-oriented and functional features, support for domain-specific notations and emphasis on scalability. Unlike generators with specialised notation, Kiama attribute grammars use standard Scala notations such as pattern-matching functions for equations. A small performance analysis shows that our approach is practical for realistic language processing.

File Attachments