https://github.com/evans-prince/command-line-excel
A modular, command-line spreadsheet application in C featuring formula evaluation, dependency management with DAG, and efficient recalculation โ complete with testing, debugging, and LaTeX-based reporting.
https://github.com/evans-prince/command-line-excel
c dag dependency-graph formula-evaluator gdb latex lldb makefile memory-bugs memory-management spreadsheet valgrind vim xcode
Last synced: about 1 month ago
JSON representation
A modular, command-line spreadsheet application in C featuring formula evaluation, dependency management with DAG, and efficient recalculation โ complete with testing, debugging, and LaTeX-based reporting.
- Host: GitHub
- URL: https://github.com/evans-prince/command-line-excel
- Owner: evans-prince
- Created: 2025-03-03T08:39:26.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-04-07T06:48:56.000Z (about 1 month ago)
- Last Synced: 2025-04-07T07:25:56.628Z (about 1 month ago)
- Topics: c, dag, dependency-graph, formula-evaluator, gdb, latex, lldb, makefile, memory-bugs, memory-management, spreadsheet, valgrind, vim, xcode
- Language: C
- Homepage:
- Size: 272 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Command-Line Excel: Spreadsheet Project
**Author:** Prince\
**Start Date:** 01-Feb-2025---
## ๐ Overview
This project is a command-line spreadsheet program developed in C, supporting integer-only cell values, formulas, and efficient recalculation using a Directed Acyclic Graph (DAG). It mimics core functionalities of Excel such as cell assignment, formula evaluation, and dependency tracking, all within a terminal interface.
---
## โจ Features
- ๐ **Spreadsheet Grid**: Supports sizes from 1x1 up to 999x18278 (A1 to ZZZ999).
- ๐ **Formula Evaluation**: Supports arithmetic operations and range-based functions (e.g., `SUM(A1:A5)`).
- ๐ **Efficient Recalculation**: Uses topological sorting and a calculation chain for updating only necessary cells.
- โป๏ธ **Dependency Management**: Tracks dependencies and dependents for each cell using CellRange structs.
- โ **Error Handling**: Detects circular references, invalid inputs, and handles edge cases like division by zero.
- ๐งช **Testing Suite**: Modular unit tests for formula parsing, input handling, and recalculation.
- ๐งฑ **Modular Design**: Divided into reusable modules for better maintainability and scalability.---
## ๐ ๏ธ Design Structure
### Spreadsheet Core
- `cell** grid`: 2D array for cells.
- `calculation_chain[]`: Optimized recalculation order.
- `CommandStatus`: Stores status and execution time of last command.### Input Handling
- Tokenizes and classifies inputs using enums.
- Validates syntax for cell assignments, formulas, function calls, and scroll commands.### Recalculation Engine
- Dirty flag mechanism for tracking updates.
- Topological sorting to determine update order.
- Selective recalculation based on dependencies.### Error Handling
- Invalid syntax detection.
- Circular reference prevention.
- Graceful handling of undefined operations (e.g., `A1=10/0`).---
## ๐คฉ Directory Structure
```plaintext
.
โโโ include/ # Header files
โ โโโ spreadsheet.h
โ โโโ recalculation.h
โ โโโ input_handler.h
โ โโโ ...
โโโ src/ # Source files
โ โโโ spreadsheet.c
โ โโโ recalculation.c
โ โโโ input_handler.c
โ โโโ ...
โโโ lib/ # Utility functions
โ โโโ utils.c
โโโ tests/ # Unit tests
โ โโโ test_input.c
โ โโโ test_formula.c
โ โโโ ...
โโโ Makefile # Build automation
โโโ report/ # LaTeX report files
โโโ report.pdf
```---
## How to Run ๐
### Prerequisites
A Linux, macOS, or Windows system with:
- GCC (GNU Compiler Collection)
- `make` or `mingw32-make`
- `pdflatex` for LaTeX report generation (optional)### ๐ข Build & Run Commands
#### Linux/macOS:
```bash
# Clone the repository
git clone https://github.com/evans-prince/Command-Line-Excel.git
cd Command-Line-Excel/Command-Line-Excel# Build the project
make# Run the program
./target/release/spreadsheet 999 18278
```#### Windows:
```bash
# Open Command Prompt (cmd) or Git Bash# Clone the repository
git clone https://github.com/evans-prince/Command-Line-Excel.git
cd Command-Line-Excel\Command-Line-Excel# Build the project
mingw32-make# Run the program
.target/release/spreadsheet.exe 999 18278
```### ๐ Optional Commands
```bash
# Run provided tests (Linux/macOS)
make test# Run tests on Windows
mingw32-make test# Clean build files
make clean # Linux/macOS
mingw32-make clean # Windows
```---
## ๐ Project Links
- ๐ **GitHub Repository**: [Command-Line Excel](https://github.com/evans-prince/Command-Line-Excel)
- ๐ฝ๏ธ **Demo Video**: [Watch Demo](https://csciitd-my.sharepoint.com/:v:/g/personal/ph1221248_iitd_ac_in/EYGqIFa5qNRIl2LBnGHC8h8BVRATkNtxBRx4TYOI_3kHiQ?e=2s2BGr)---
## ๐ฃ Contributions
This project was collaboratively developed by:
- ๐จโ๐ป Prince
- ๐จโ๐ป Aditya---
## ๐ Contact
If you'd like to know more or contribute, feel free to open an issue or contact us via GitHub!