- Uk'taad B'mal, A Haskell Companion for "Fold and Unfold for Program Semantics", Internal technical memorandum , June 15, 2004
- Uk'taad B'mal, A Haskell Companion for "Using catamorphisms, subtypes and monad transformers for writing modular functional interpreters", Internal technical memorandum , March 3, 2004
We have developed a library for constructing composable, monadic interpreters in Haskell. The InterpreterLib library provides a collection of functions and type classes that implement semantic algebras in the style of Hutton and Duponcheel. InterpreterLib structures interpreters around a Functor and Algebra written for each AST construct. AST elements are defined non-recursively and composed using a Sum type. The actual language is formed by taking the least fixed point of the language Sum. To interpret and AST element, a general catamorphism is applied using Haskell's typeclass system to select an appropriate algebra for interpreting each element.
Use the Haddock documentation for InterpreterLib for reference.
The AST Builder executable provides a compiler for a small language for specifying regular languages (not yet released). The compiler output consists of Haskell modules of boilerplate for functors and their algebras.
The Algebra Compiler (algc) defines a language and compiler for defining boilerplate for semantic algebras. algc is not required to use InterpreterLib, but is highly useful for defining semantic algebras over InterpreterLib structures.
Also included is TermLib, a collection of pre-defined standard AST elements that represent many common language constructs (not yet released). If an AST construct is not available, the AST Builder astbuilder can be used to automatically generate necessary data structures and boilerplate from a simple interface specification.
- InterpreterLib v1.0 -
InterpreterLib v1.0 Cabal package. This is milestone release with a complete library refactoring. The AlgebraCompiler and Comonadic components have been separated; this package includes only the modules for AST and algebra manipulation. Be sure to also download TypeCast v1.0 and the AST Builder v1.0!
- TypeCast v1.0 -
TypeCast v1.0 Cabal package. Small bit of dependent type-hackery needed by InterpreterLib.
- AST Builder v1.0 -
AST Builder v1.0 Cabal package.
- algc v0.1 -
algc v0.1 Cabal package.
- InterpreterLib v0.3 -
InterpreterLib v0.3 Cabal package. This is a bug fix release.
- InterpreterLib v0.2 -
InterpreterLib v0.2 Cabal package. New in this version are: (i) generalized support for defining lambda evaluation; and (ii) a few bug fixes.
- InterpreterLib v0.1 -
InterpreterLib v0.1 Cabal package. New in this version are: (i) language support for comonadic handling of interpreter environments; and (ii) a few bug fixes.
- InterpreterLib v0.0 -
InterpreterLib v0.0 Cabal package. Intial release of the base system.
- InterpreterLib -
InterpreterLib package. Documentation is sparse.
- Duponcheel Companion -
Notes and interpreters based on Duponcheel's modular interpreters paper.
- Hutton Companion -
Notes and interpreters based on Hutton's paper using folds to define semantics.