Skip to content
Open to SDE roles · full-time and internships +91 90504 57303
Work/01
Jan – Mar 2025 · Systems programming · Team project

Command-line spreadsheet

A full spreadsheet engine in plain C. Formulas, ranges, a dependency graph that only recalculates what changed, and errors that never crash it.

CDAG recalculationValgrindGDB/LLDBWebAssembly
1.8 crorecells in one sheet (999 × 18,278)
<1 msto recalculate a 998-cell chain, live below
3,364lines of C, tests included
Valgrindused to hunt down memory leaks
  • Every formula registers its inputs in a dependency graph, so an edit recalculates only what is downstream, in topological order.
  • A modular parser handles formulas, ranges like SUM(A1:A10) and w/a/s/d scrolling, and turns bad input into clear statuses instead of crashes.
  • Cycle detection rejects an edit that would loop, and Valgrind plus GDB/LLDB were used to hunt down leaks and hard bugs.
How it works

The story, in chapters.

Chapter 1

Cells that know who depends on them

Every formula registers its inputs in a directed acyclic graph. When a cell changes, the engine walks the graph and recalculates only what is downstream, in order. Nothing else is touched.

A sheet can hold 1.8 crore cells: 999 rows by 18,278 columns (A to ZZZ).

Chapter 2

A parser that forgives typos but not nonsense

Commands like B2=SUM(A1:A10), C1=MAX(A1:B9) or scrolling with w/a/s/d go through a small modular parser. Invalid cells, bad ranges and division by zero come back as clear statuses instead of crashes.

Chapter 3

Cycles are caught before they happen

If an edit would create a loop (A1 needs B1 needs A1), cycle detection rejects it and the old value stays. Try it in the live demo.

Chapter 4

Tested like it matters

We unit-tested the core modules, found and fixed memory leaks with Valgrind, and stepped through the hard bugs with GDB and LLDB.

Team project. We built it together.

Try it

Run it yourself.

Live · the real C engine, compiled to WebAssembly
Loading the engine…
Click a cell and type a formula, or try a button.
The real program, recorded.The real program. Scroll to play it, scroll back to rewind.
Next project
Sparse spreadsheet in Rust
Keep going
CV Contact