Statically Typed Purely Functional Definitional Interpreters for Essentials of Programming Languages
Kwanghoon Choi
Abstract
Definitional interpreters provide an executable and pedagogically effective way to explain programming language semantics. However, when implemented in a dynamically typed and effectful metalanguage, semantic components such as stores, continuations, handlers, substitutions, and scheduling states may remain implicit in the host-language implementation, making it harder to see how language extensions affect interpreter structure. This paper reconstructs the family of interpreters from Essentials of Programming Languages (EOPL) in Haskell, a statically typed and purely functional metalanguage, for pedagogical use. We preserve the object languages, examples, and tests of EOPL while making their semantic components explicit through algebraic data types, evaluator signatures, and explicit semantic domains. Across 15 interpreters and 6 type checkers, language extensions are exposed as systematic type-directed changes. The reconstruction is currently used in undergraduate and graduate programming language courses, where students learn interpreter construction through incremental and test-driven development. We further illustrate its pedagogical use through three case studies that progressively extend students' experience: composing mutable state and exception handling, deriving an actor-based interpreter from the typed structure of the EOPL thread interpreter, and translating the CHECKED interpreter and type checker into Rocq to mechanize type safety. Together, the classroom experience and case studies suggest that the reconstruction provides a concrete bridge from learning programming language concepts through executable interpreters to language design and mechanized reasoning.
Create a lesson
Related papers
TauLang: A Language and Compiler for Space-Time Programming on Statically Scheduled Accelerators
Shared title terminology · Xuxiao Yang, Junchi Wu, Yuqi Peng et al.
Agent-Native by Design: A Programming Language for Agentic Applications
Shared title terminology · Jayanaka Dantanarayana, Savini Kashmira, Xiaoyu Ma et al.
Functional Logic Programming: Improving Logic Programs with Ease
Shared title terminology · Michael Hanus
Grassmann: The Coordinate-Independent Linear Algebra Programming Language
Shared title terminology · Theadora Fields Collin, Gilbert Bernstein, Oded Stein et al.
The Reversible Intermediate Language L4, its Type System, and its Bidirectional Small-Step Semantics
Shared title terminology · Torben Ægidius Mogensen
Coexponential Exploration in the Clef Programming Language
Shared title terminology · Houston Haynes