Modular Language Specifications in Haskell (original) (raw)

Modular Executable Language Specifications in Haskell

We propose a framework for specification of programming language semantics, abstract and concrete syntax, and lexical structure. The framework is based on Modular Monadic Semantics and allows independent specification of various language features. Features such as arithmetics, conditionals, exceptions, state and nondeterminism can be freely combined into working interpreters, facilitating experiments in language design. A prototype implementation of this system in Haskell is described and possibilities for more sophisticated interpreter generator are outlined.

A Dynamic Semantics for Haskell

1992

This paper defines a dynamic semantics for the functional programming language Haskell. The semantics defines the meaning of expressions, modules and programs, including all nonoptionalI/O requests. All constructs in the Haskell language are considered. We use thesame natural semantics style as the definition of Standard ML. For brevity, we assume that the translations specified by the Wadler/Peyton Jones staticsemantics have been performed, and base our source language on the target language of thestatic semantics.

An implementation of the Haskell language

1990

Abstract This report describes the design and implementation of HASKELL system. The areas implemented are the lexical analysis, parsing, intepretation of the lambda tree, and machine code generation. Because of the size, complexity and novelty of the language many of these areas present particular difficulty. A considarable amount of meta-programming was used in order to tackle the size of the project.

Formulating haskell

1992

The functional programming language Haskell is examined from the point of view of proving programs correct. Particular features explored include the data type definition facilities, classes, the behaviour of patterns and guards and the monad approach to IO in the Glasgow Haskell compiler.

Deriving Compilers from Monadic Semantics

The monadic style of language specification [6, 16, 15, 26] has the advantages of modularity and extensibility: it is simple to add or change features in an interpreter to reflect modifications in the source language. It has proven difficult to extend the method to compilation, because there is considerable interaction between different features. We demonstrate that by introducing machine-like stores (code and data) into the monadic semantics (to achieve pass separation [12]) and then partially evaluating the resulting semantic expressions, we can achieve many of the same advantages for a compiler as for an interpreter. A number of language constructs and features are compiled: expressions, while loops, CBV and CBN evaluation of -expressions, dynamic scoping, and various imperative features. The treatment of recursive procedures is outlined as well. The resulting method allows compilers to be constructed in a mix-and-match fashion just as in a monad-structured interpreter. K...

Reusable semantic specifications of programming languages

In this tutorial, we compare the main approaches for programming language semantic specification from the point of view of modularity and reusability. We will also present reusable monadic semantics, which combines monadic semantics with generic programming concepts and we will present the specification of simple functional, imperative and logic programming languages. The specifications are made from reusable semantic building blocks, which facilitates the comparison between different paradigms.

Report on the programming language Haskell, a non-strict, purely functional …

Sigplan …, 1992

Wise, and Jonathan Young-for the major contributions they have made to previous versions of this report. We also thank those who have participated in the lively discussions about Haskell on the FP and Haskell mailing lists. x PREFACE 1. At the topmost level a Haskell program is a set of modules, described in Section 5. Modules provide a way to control namespaces and to re-use software in large programs. 2. The top level of a module consists of a collection of declarations, of which there are several kinds, all described in Section 4. Declarations define things such as ordinary values, datatypes, type classes, and fixity information. 3. At the next lower level are expressions, described in Section 3. An expression denotes a value and has a static type; expressions are at the heart of Haskell programming "in the small." 4. At the bottom level is Haskell's lexical structure, defined in Section 2. The lexical structure captures the concrete representation of Haskell programs in text files. This report proceeds bottom-up with respect to Haskell's syntactic structure. The sections not mentioned above are Section 6, which describes the standard built-in datatypes and classes in Haskell, and Section 7, which discusses the I/O facility in Haskell (i.e. how Haskell programs communicate with the outside world). Also, there are several appendices describing the Prelude, the concrete syntax, literate programming, the specification of derived instances, and pragmas supported by most Haskell compilers. Examples of Haskell program fragments in running text are given in typewriter font:

Implementing Haskell: Language implementation as a tool building exercise

1993

Abstract Although a number of tool boxes for compiler construction exist, the language implementation task can often be made easier by building specialised tools. A prototype Haskell system was implemented within a four month period using such an approach. The system is currently used as a front end for a transputer array, Haskell implementation. In this article we describe the tool building aspect of the implementation process.

Semantics of pH: A parallel dialect of Haskell

1995

The semantics of kernel pH are de ned in the form of a parallel, normalizing interpreter. A description of I-structure and M-structure operators is also given within the same framework. Semantics of barriers in pH are presented by translation into the kernel language without barriers. The framework presented is also suitable for multithreaded compilation of pH.