VisiCalc Reconstructed
a day ago
- #programming
- #spreadsheet
- #VisiCalc
- VisiCalc was the first spreadsheet software created in 1979 by Dan Bricklin and Bob Frankston.
- It became a 'killer app' for Apple ][, selling over 1 million copies and turning personal computers into business tools.
- The article describes an attempt to rebuild a minimal VisiCalc clone from scratch, focusing on data model, formula evaluator, and UI.
- Cells in a spreadsheet can contain values (numbers or text), formulas, or be empty. Formulas in VisiCalc started with '+' instead of '='.
- The data model for cells includes types (EMPTY, NUM, LABEL, FORMULA), values, and raw user input.
- A simple grid structure is used to represent the spreadsheet with a limited number of rows and columns.
- A recursive descent parser is implemented to evaluate formulas, handling operations like addition, subtraction, multiplication, and division.
- Cell references are parsed and evaluated, supporting functions like @SUM, @ABS, @INT, and @SQRT.
- Recalculation is handled by re-evaluating the entire spreadsheet iteratively until no changes are detected.
- A simple TUI (Terminal User Interface) is built using ncurses to navigate, edit, and display cells.
- The UI includes a status bar, edit line, column headers, and a grid view with scrolling support.
- Input handling supports navigation, cell editing, and commands like blanking cells (/B), quitting (/Q), and formatting (/F).
- The project is implemented in under 500 lines of C, capturing the essence of VisiCalc's functionality.
- Missing features include file I/O, replication commands, more functions, and larger grid support.
- The article concludes by noting the enduring legacy of VisiCalc's design in modern spreadsheets.