5 Tutorial: From Models to Interpreters

A core use case for algebraic is fast and cheap interpreter development. With the right tooling, throw-away interpreters can be an easy way to explore and validate language design choices quickly.

As it happens, Haskell is already pretty good at this. Algebraic data types and functional destructuring syntax make interpreters easy to read and write, and its type system keeps track of pervasive breaking changes for you. algebraic addresses the untyped half of this equation—algebraic data structures (ADTs sans typing constraints) with destructuring syntax.

In this series, we will implement three interpreters based on the models originally used to design algebraic itself:

  1. A core model based on the untyped λ-calculus,

  2. An extended syntax that compiles down to core constructs, and

  3. A hosted variant that borrows additional constructs from the implementing platform.

The tutorials are written in an informal style with code and discussion mixed together. If you prefer source code, it can be read all in one place on github.

    5.1 The Core Calculus

    5.2 A Syntax Extension

    5.3 Exposing the Host