Idea · Oct 6, 2026
Build Your Own Spreadsheet Engine
A staged course project where students build a working spreadsheet: formula tokenizer and parser, dependency graph, topological recalculation, cycle detection, undo/redo and a React grid on top.
What it would do
Spreadsheets are the most widely used programming environment in the world, and building one touches parsing, graphs, incremental computation and UI. Milestone 1 is a tokenizer and recursive-descent parser for formulas (=A1+SUM(B1:B5)*2) producing an AST, tested against a provided suite. Milestone 2 adds cell references, ranges and a dependency graph, with recalculation in topological order and #CYCLE! errors reported via cycle detection. Milestone 3 makes recalculation incremental: editing one cell recomputes only its transitive dependents, and students measure the speedup on a 10,000-cell benchmark sheet. Milestone 4 adds a virtualized React grid, copy/paste with relative reference adjustment, and undo/redo via the command pattern. An optional stretch adds CSV import/export or a tiny function library (IF, VLOOKUP, AVERAGE) with type errors like #VALUE!.
Key features
- Formula grammar with a provided test suite and a reference AST printer for self-checking
- Dependency graph with topological recalculation and cycle detection
- Incremental recompute benchmark that students instrument and report on
- Relative/absolute reference rewriting on copy/paste ($A$1 vs A1)
- Command-pattern undo/redo and a virtualized grid UI