Attribute Grammars (AGs), a general-purpose formalism for describing recursive computations over data types, avoid the trade-off which arises when building software incrementally: should it be easy to add new data types and data type alternatives or to add new operations on existing data types? However, AGs are usually implemented as a pre-processor, leaving e.g. type checking to later processing phases and making interactive development, proper error reporting and debugging difficult. Embedding AG into Haskell as a combinator library solves these problems. Previous attempts at embedding AGs as a domain-specific language were based on extensible records and thus exploiting Haskell’s type system to check the well-formedness of the AG, but fell short in compactness and the possibility to abstract over oft occurring AG patterns. Other attempts used a very generic mapping for which the AG well-formedness could not be statically checked. We present a typed embedding of AG in Haskell satisfying all these requirements. The key lies in using HList-like typed heterogeneous collections (extensible polymorphic records) and expressing AG well-formedness conditions as type-level predicates (i.e., typeclass constraints). By further type-level programming we can also express common programming patterns, corresponding to the typical use cases of monads such as Reader, Writer and State. The paper presents a realistic example of type-class-based type-level programming in Haskell.

Papers

Title : Attribute Grammars Fly First-Class: How to do aspect oriented programming in Haskell

Authors : Marcos Viera, S. Doaitse Swierstra, Wouter S. Swierstra

Full Text : pdf

Slides : pdf

BibTeX : bib


Title : UUAG Meets AspectAG: How to make Attribute Grammars First-Class

Authors : Marcos Viera, S. Doaitse Swierstra, Arie Middelkoop

Full Text : pdf

Slides :

BibTeX :

Benchmarks : Benchmarks


Title : Attribute Grammars Macros

Authors : Marcos Viera, S. Doaitse Swierstra

Full Text : pdf

Slides :

BibTeX :

Packages

AspectAG : AspectAG (includes examples)

Examples

Oberon-0 : tar.gz (from the LDTA 2011 tool challenge)
Topic attachments
I Attachment Action Size Date Who Comment
VSM12.pdfpdf VSM12.pdf manage 384.7 K 01 Jul 2012 - 22:17 UnknownUser paper-ldta
oberon0-0.0.1.tar.gzgz oberon0-0.0.1.tar.gz manage 41.3 K 14 Aug 2012 - 18:47 UnknownUser  
paper-icfp.bibbib paper-icfp.bib manage 0.3 K 07 Jul 2009 - 19:43 UnknownUser  
paper-icfp.pdfpdf paper-icfp.pdf manage 215.3 K 07 Jul 2009 - 19:35 UnknownUser  
paper.pdfpdf paper.pdf manage 350.5 K 10 Jul 2012 - 12:55 UnknownUser  
talk.pdfpdf talk.pdf manage 503.1 K 08 Sep 2009 - 11:13 UnknownUser  
Topic revision: r9 - 14 Aug 2012, MarcosViera
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding UUCS? Send feedback