# daryanechaeva/csv-reader architecture

> Architecture diagram of the GitHub repository daryanechaeva/csv-reader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daryanechaeva/csv-reader
- Repository: https://github.com/daryanechaeva/csv-reader

## Overview

CSV reader is a command-line evaluator: a user supplies a file, the program loads and validates its rows and columns, resolves formula dependencies and arithmetic, then prints the evaluated table. The main routine orchestrates loading, computation and output. The Table holds source cells and computed state; hash maps index row IDs and column names. README capabilities are reflected in the evaluator label; relationships follow sampled source, while broader error cases are documented rather than separately modeled.

Main entry points: [`src/parser.c`](https://github.com/daryanechaeva/csv-reader/blob/main/src/parser.c) (CSV loader), [`src/main.c`](https://github.com/daryanechaeva/csv-reader/blob/main/src/main.c) (Workflow entry), [`src/table.c`](https://github.com/daryanechaeva/csv-reader/blob/main/src/table.c) (Table lifecycle and output), [`src/calculate.c`](https://github.com/daryanechaeva/csv-reader/blob/main/src/calculate.c) (Formula evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["Workflow entry<br/>[main.c]"]
end

subgraph group_table["CSV and table"]
  node_csv["CSV loader<br/>[parser.c]"]
  node_tabledata["Table state<br/>[table.h]"]
  node_tableops["Table lifecycle and output<br/>[table.c]"]
end

subgraph group_eval["Evaluation and indexing"]
  node_compute["Formula evaluator<br/>[calculate.c]"]
  node_index["Row and column maps<br/>[hashmap.c]"]
end

node_user(("CLI user"))
node_file["CSV file"]
node_stdout(("Standard output"))

node_user -->|"runs with file"| node_main
node_main -->|"calls load"| node_csv
node_csv -->|"reads"| node_file
node_csv -->|"populates"| node_tabledata
node_csv -->|"looks up and inserts"| node_index
node_csv -->|"initializes and frees"| node_tableops
node_main -->|"calls compute"| node_compute
node_compute -->|"reads and updates"| node_tabledata
node_compute -->|"resolves references"| node_index
node_main -->|"calls print and free"| node_tableops
node_tableops -->|"reads and frees"| node_tabledata
node_tableops -->|"prints CSV"| node_stdout

click node_main "https://github.com/daryanechaeva/csv-reader/blob/main/src/main.c"
click node_csv "https://github.com/daryanechaeva/csv-reader/blob/main/src/parser.c"
click node_tabledata "https://github.com/daryanechaeva/csv-reader/blob/main/include/table.h"
click node_tableops "https://github.com/daryanechaeva/csv-reader/blob/main/src/table.c"
click node_compute "https://github.com/daryanechaeva/csv-reader/blob/main/src/calculate.c"
click node_index "https://github.com/daryanechaeva/csv-reader/blob/main/src/hashmap.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_user toneBlue
class node_csv,node_tabledata,node_tableops toneAmber
class node_compute,node_index toneMint
class node_file,node_stdout toneIndigo
```

## Components

### CLI workflow

- [Workflow entry](https://github.com/daryanechaeva/csv-reader/blob/main/src/main.c): `src/main.c`

### CSV and table

- [CSV loader](https://github.com/daryanechaeva/csv-reader/blob/main/src/parser.c): `src/parser.c`
- [Table state](https://github.com/daryanechaeva/csv-reader/blob/main/include/table.h): `include/table.h`
- [Table lifecycle and output](https://github.com/daryanechaeva/csv-reader/blob/main/src/table.c): `src/table.c`

### Evaluation and indexing

- [Formula evaluator](https://github.com/daryanechaeva/csv-reader/blob/main/src/calculate.c): `src/calculate.c`
- [Row and column maps](https://github.com/daryanechaeva/csv-reader/blob/main/src/hashmap.c): `src/hashmap.c`

### Other components

- **CLI user**
- **CSV file**
- **Standard output**

## Connections

- CLI user → Workflow entry: runs with file
- Workflow entry → CSV loader: calls load
- CSV loader → CSV file: reads
- CSV loader → Table state: populates
- CSV loader → Row and column maps: looks up and inserts
- CSV loader → Table lifecycle and output: initializes and frees
- Workflow entry → Formula evaluator: calls compute
- Formula evaluator → Table state: reads and updates
- Formula evaluator → Row and column maps: resolves references
- Workflow entry → Table lifecycle and output: calls print and free
- Table lifecycle and output → Table state: reads and frees
- Table lifecycle and output → Standard output: prints CSV
