GCSE'99 - Generative and Component-Based Software Engineering. |
Lazy evaluation allows compiler writers to ignore a separatation into passes, and to focus on the logical structure of their compiler instead. This is also a feature of attribute grammars, which can be viewed as a particular style of lazy functional program. Compilers written in attribute grammar style are typically structured by production. It is hard to structure them by semantic aspect, such as “environment” or “lexical level”, and it is certainly not possible to view these aspects as separate units of compilation.
In this paper we propose a technique for making compiler aspects first class objects, that can be stored, manipulated, and combined. We propose a modest set of combinators that achieve this task in Haskell. The combinator library is an application of recent work on polymorphic type systems for record operations, in particular that of Gaster and Jones, and also of a technique due to Remy which types symmetric record concatenation “for free”.