Abstract

This thesis presents a novel way to introduce mutually recursive first-class modules into a call-by-value programming language. In our approach, all modules are accessed through dot-notation without any additional syntax for mutually recursive modules. In contrast to other call-by-value languages, mutually recursive modules can be declared without the use of module composition or a self variable. This simple mechanism is achieved through a dependency analysis. This analysis computes all necessary information, which, in other approaches, must be provided by the programmer. The transformation based denotational semantics of a call-by-value language with first-class, hierarchical and recursive modules is presented. For this purpose, a small functional language—GLang—is defined. GLang uses the notation of Groups, as proposed by Pepper and Hofstedt in [31]. Groups merge dynamic data structures with aspects of modularisation and name binding in functional programming languages. Groups are first-class values, which capture recursive definitions, lexical scoping, hierarchical structuring of programs, and dynamically typed data structures in a single construction. This thesis clarifies what problems occur in combining nested, recursive and first-class modules and shows how to solve these problems by a novel path resolution algorithm. This path resolution algorithm is the basis for a dependency analysis which determines the evaluation order for definitions. This evaluation order is used to transform a GLang expression into an intermediate representation. Each Group is transformed into a component which contains all definitions of this Group in dependency order. This ensures that Groups are kept as entities. For the intermediate representation, an evaluation function is provided. The transformation and the evaluation function together define the call-by-value semantics of GLang. Moreover, the compilation into a call-by-value λ-calculus with records and recursive let-expressions is defined, and we discuss different possibilities to extend GLang.

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