Skip to content
reduction-lab

reduction-lab

Every expression has a story. Watch it unfold.

Created on 25th October 2026

•

reduction-lab

reduction-lab

Every expression has a story. Watch it unfold.

The problem reduction-lab solves

Reduction Lab is an interactive, browser-based interpreter that makes the execution of functional programs visible, one reduction at a time.

Traditional REPLs show the final result but hide the intermediate computation. This makes it difficult to understand evaluation order, beta reduction, capture-avoiding substitution, and how higher-order functions such as map and fold transform lists.

Reduction Lab addresses this by rewriting expressions in place and highlighting the redex being reduced, the result of the previous step, and the list element or fold accumulator currently being processed. Users can step forward, revisit recorded states, inspect the syntax tree, and understand each reduction through a dedicated explanation panel.

Built for the Syntax Error 2026 Functional Programming Track, the project implements a small Haskell-like language supporting numbers, booleans, lists, functions, let, conditionals, operators, map, and fold. Every visualised state comes from the actual small-step reducer, while an independent big-step evaluator provides a reference for semantic consistency testing.

The result is a transparent, interactive way to explore how functional programs execute—not just what they return.

Challenges we ran into

1. Preventing variable capture: Naive substitution can change program meaning. We implemented capture-avoiding substitution using alpha-renaming to preserve semantics.

2. Ensuring evaluator consistency: We tested the independent small-step reducer and big-step evaluator against a hand-written corpus and 800 seeded random programs.

3. Accurate visualisation: We used AST node IDs, source spans, and reducer-generated metadata to highlight actual reduction steps instead of relying on scripted animations or text matching.

4. Visualising map and fold: Since the current expression alone cannot retain all list-processing context, we added step metadata and controller bookkeeping to track active elements and accumulator history.

5. Handling runaway execution: We introduced parser, tree-depth, evaluator, step-count, and expression-size limits, with explicit errors for exceeded limits.

Tracks Applied (2)

Open Track - Development

Reduction Lab fits the Open Track because it combines programming language theory, interpreter engineering, and interact...Read More

Functional Programming Track

Reduction Lab fits the Functional Programming track by implementing a Haskell-like interpreter supporting lambda functio...Read More

FP Launchpad

Discussion

Builders also viewed

See more projects on Devfolio