Abstract

Ideally complexity is managed by composing a system out of quite a few, more or less independent, and much smaller descriptions of various aspects of the overall artefact. When describing (extensible) programming languages, attribute grammars have turned out to be an excellent tool for modular definition and integration of their different aspects. In this paper we show how to construct a programming implementation by composing a collection of separately compiled attribute grammar fragments, each describing a separate aspect of the language.More specifically we describe how to use a coherent set of libraries and tools which together makes it possible to express this directly in Haskell, where the correctness of the composition is enforced through the Haskell type system's ability to represent attribute grammars as plain Haskell values and their interfaces as Haskell types makes this possible.Semantic objects thus constructed can be combined with parsers which are constructed on the fly out of a collection of grammar fragments, which are also represented by typed Haskell values. Again the type checker prevents unsound compositions.Using a very small example and some simple extensions, we show how our techniques fit together towards the construction of extensible compilers out of a collection of pre-compiled, statically type-checked language definition fragments.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call