First Class Syntax, Semantics and Their Composition

Publication date

2013-03-08

Authors

Viera, M.O.ISNI 0000000419512823

Editors

Advisors

Supervisors

Swierstra, S.D.ISNI 0000000052441415
Pardo, A.

DOI

Document Type

Dissertation
Open Access logo

License

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 artifact. 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 thesis we show how to construct a programming language implementation by composing a collection of attribute grammar fragments describing separate aspects of the language. More specifically we describe a coherent set of libraries and tools which together make this possible in Haskell, \emph{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. Semantic objects thus constructed can be combined with parsers which are constructed on the fly out of parser fragments and are also represented as typed Haskell values. Again the type checker prevents insane compositions. As a small case study of the techniques proposed in this thesis, we implemented a compiler for the (Pascal-like) imperative language Oberon0. Through an incremental design, we show the modularity capacities of our techniques.

Keywords

Extensible Languages, Attribute Grammars, Typed Grammars, Typed Transformations, Parsing, Haskell

Citation

Viera, M O 2013, 'First Class Syntax, Semantics and Their Composition', Doctor of Philosophy, Utrecht University.