TL;DR — RESL extends the familiar REPL (Read-Eval-Print Loop) with synthesis. Write partial expressions with "holes" (??) and input-output examples, and the system fills in the holes automatically. It is like autocomplete meets program synthesis.
The Problem
Programming often involves repetitive transformations. You know the pattern — filter some data, map over it, reshape it — but writing the exact expression is tedious. REPLs help you explore and iterate, but you still have to write everything yourself, character by character.
Consider a data scientist working in a REPL. They have a list of records and want to extract, filter, and transform fields. The high-level structure is obvious, but the precise lambda expressions? Those take trial and error. What if you could leave the tedious parts blank and let the computer figure them out?
The Key Idea
RESL replaces the Print step in a traditional REPL with Synth. Instead of printing a result and asking you to refine your code manually, RESL synthesizes completions for the parts you left unfinished.
The loop works like this:
- Read a sketch — an expression with holes (
??) marking unknown sub-expressions - Evaluate the known parts of the sketch
- Synthesize completions for the holes using input-output examples as a specification
- Show ranked candidates that satisfy the examples
REPL vs. RESL
REPL
RESL
RESL replaces Print with Synth: instead of showing results and starting over, it fills in the blanks for you.
Interactive Demo
Try the RESL experience below. Each exercise presents a sketch with holes (??) and input-output examples. Click Synthesize to see ranked candidate completions appear one by one. Green checks indicate candidates that match all examples; red marks indicate partial or no match.
How It Works
At its core, RESL uses sketch-based synthesis. The programmer provides a partial program — a sketch — and the synthesizer searches for completions that satisfy the given examples.
Sketches and Holes
A sketch is an ordinary expression where some sub-expressions are replaced with ??. Each hole represents an unknown piece of code that the synthesizer must fill in. The surrounding context (the known parts of the sketch) constrains what the hole can be — its type, the variables in scope, and the expected behavior.
Example-Guided Ranking
RESL ranks candidates by how well they match the provided examples. A candidate that satisfies all input-output pairs ranks highest. When multiple candidates match, RESL uses heuristics like expression simplicity and consistency with partial evaluations to break ties.
Interactive Refinement
Because RESL operates in a loop, you can refine iteratively. If the top candidate is not quite right, add more examples or restructure your sketch. Each iteration narrows the search space, converging on the correct program faster than writing it from scratch.
Key insight: By embedding synthesis into the interactive programming loop, RESL turns program synthesis from a batch process into a conversational tool. The programmer and the synthesizer collaborate, each contributing what they do best.
Results
RESL demonstrates that program synthesis can be practical for everyday interactive programming. In evaluations on data-wrangling benchmarks:
- RESL successfully synthesized completions for tasks involving list transformations, string manipulations, and data filtering
- The interactive loop let users converge on correct programs significantly faster than writing them from scratch
- Sketch-based specifications proved more natural than writing full input-output specifications alone, since programmers could express the parts they already knew
- Ranking by example match allowed users to quickly identify the best candidate without inspecting every option
The RESL approach shows that the gap between "I know roughly what I want" and "here is the exact code" can be bridged by synthesis, right inside the programming environment you already use.