# 8ored/calculator_suite architecture

> Architecture diagram of the GitHub repository 8ored/calculator_suite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/8ored/calculator_suite
- Repository: https://github.com/8ored/calculator_suite

## Overview

Calc-Suite is an interactive, in-memory command-line calculator. The user enters commands; the CLI dispatches variable, expression, and polynomial operations, records calculations in a bounded history queue, and can encode that history with Huffman coding for display or decoding. The main workflow and major README capabilities are represented. The excerpts show expression, polynomial, queue, and codec implementations; some CLI handlers are omitted, so capability links for those handlers rely on README documentation rather than unseen source details.

Main entry points: [`main.cpp`](https://github.com/8ored/calculator_suite/blob/main/main.cpp) (CLI dispatcher), [`data_storage.cpp`](https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp) (Polynomial arithmetic), [`expression_engine.cpp`](https://github.com/8ored/calculator_suite/blob/main/expression_engine.cpp) (Expression evaluation), [`symbol_table.cpp`](https://github.com/8ored/calculator_suite/blob/main/symbol_table.cpp) (AVL symbol table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command interface"]
  node_cli["CLI dispatcher<br/>[main.cpp]"]
end

subgraph group_variables["Variables"]
  node_variable_commands["Variable commands<br/>[main.cpp]"]
  node_symbol_table[("AVL symbol table<br/>[symbol_table.cpp]")]
  node_substitution["Variable substitution<br/>[main.cpp]"]
end

subgraph group_calculations["Calculations"]
  node_expression_conversion["Expression conversion"]
  node_expression_evaluation["Expression evaluation"]
  node_polynomial_input["Polynomial input<br/>[data_storage.cpp]"]
  node_polynomial_arithmetic["Polynomial arithmetic<br/>[data_storage.cpp]"]
end

subgraph group_history_compression["History and compression"]
  node_history_queue[("History queue<br/>[data_storage.cpp]")]
  node_history_view["History display<br/>[data_storage.cpp]"]
  node_history_text["History text<br/>[main.cpp]"]
  node_huffman["Huffman codec<br/>[huffman.cpp]"]
  node_code_table["Code table<br/>[huffman.cpp]"]
  node_decoded_output["Decoded output<br/>[main.cpp]"]
end

node_user(("User"))

node_user -->|"enters commands"| node_cli
node_cli -->|"dispatches"| node_variable_commands
node_variable_commands -->|"updates or lists"| node_symbol_table
node_cli -->|"routes expressions"| node_substitution
node_substitution -->|"looks up variables"| node_symbol_table
node_cli -->|"converts expressions"| node_expression_conversion
node_cli -->|"evaluates expressions"| node_expression_evaluation
node_expression_evaluation -.->|"uses converted form"| node_expression_conversion
node_cli -->|"builds polynomials"| node_polynomial_input
node_cli -->|"requests add or multiply"| node_polynomial_arithmetic
node_cli -->|"records results"| node_history_queue
node_cli -->|"shows history"| node_history_view
node_cli -->|"reads history snapshot"| node_history_text
node_cli -->|"encodes or decodes"| node_huffman
node_cli -->|"shows codes"| node_code_table
node_cli -->|"prints decoded text"| node_decoded_output
node_history_text -->|"dequeues snapshot"| node_history_queue
node_polynomial_input -->|"supplies operands"| node_polynomial_arithmetic
node_polynomial_arithmetic -->|"records operation"| node_history_queue

click node_cli "https://github.com/8ored/calculator_suite/blob/main/main.cpp"
click node_variable_commands "https://github.com/8ored/calculator_suite/blob/main/main.cpp"
click node_symbol_table "https://github.com/8ored/calculator_suite/blob/main/symbol_table.cpp"
click node_substitution "https://github.com/8ored/calculator_suite/blob/main/main.cpp"
click node_expression_conversion "https://github.com/8ored/calculator_suite/blob/main/expression_engine.cpp"
click node_expression_evaluation "https://github.com/8ored/calculator_suite/blob/main/expression_engine.cpp"
click node_polynomial_input "https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp"
click node_polynomial_arithmetic "https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp"
click node_history_queue "https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp"
click node_history_view "https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp"
click node_history_text "https://github.com/8ored/calculator_suite/blob/main/main.cpp"
click node_huffman "https://github.com/8ored/calculator_suite/blob/main/huffman.cpp"
click node_code_table "https://github.com/8ored/calculator_suite/blob/main/huffman.cpp"
click node_decoded_output "https://github.com/8ored/calculator_suite/blob/main/main.cpp"

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_cli,node_user toneBlue
class node_variable_commands,node_symbol_table,node_substitution toneAmber
class node_expression_conversion,node_expression_evaluation,node_polynomial_input,node_polynomial_arithmetic toneMint
class node_history_queue,node_history_view,node_history_text,node_huffman,node_code_table,node_decoded_output toneRose
```

## Components

### Command interface

- [CLI dispatcher](https://github.com/8ored/calculator_suite/blob/main/main.cpp): `main.cpp`

### Variables

- [Variable commands](https://github.com/8ored/calculator_suite/blob/main/main.cpp): `main.cpp`
- [AVL symbol table](https://github.com/8ored/calculator_suite/blob/main/symbol_table.cpp): `symbol_table.cpp`
- [Variable substitution](https://github.com/8ored/calculator_suite/blob/main/main.cpp): `main.cpp`

### Calculations

- [Expression conversion](https://github.com/8ored/calculator_suite/blob/main/expression_engine.cpp): `expression_engine.cpp`
- [Expression evaluation](https://github.com/8ored/calculator_suite/blob/main/expression_engine.cpp): `expression_engine.cpp`
- [Polynomial input](https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp): `data_storage.cpp`
- [Polynomial arithmetic](https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp): `data_storage.cpp`

### History and compression

- [History queue](https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp): `data_storage.cpp`
- [History display](https://github.com/8ored/calculator_suite/blob/main/data_storage.cpp): `data_storage.cpp`
- [History text](https://github.com/8ored/calculator_suite/blob/main/main.cpp): `main.cpp`
- [Huffman codec](https://github.com/8ored/calculator_suite/blob/main/huffman.cpp): `huffman.cpp`
- [Code table](https://github.com/8ored/calculator_suite/blob/main/huffman.cpp): `huffman.cpp`
- [Decoded output](https://github.com/8ored/calculator_suite/blob/main/main.cpp): `main.cpp`

### Other components

- **User**

## Connections

- User → CLI dispatcher: enters commands (evidence: `README.md`)
- CLI dispatcher → Variable commands: dispatches (evidence: `README.md`)
- Variable commands → AVL symbol table: updates or lists
- CLI dispatcher → Variable substitution: routes expressions (evidence: `README.md`)
- Variable substitution → AVL symbol table: looks up variables (evidence: `main.cpp`)
- CLI dispatcher → Expression conversion: converts expressions (evidence: `main.cpp`)
- CLI dispatcher → Expression evaluation: evaluates expressions (evidence: `main.cpp`)
- Expression evaluation → Expression conversion: uses converted form (evidence: `expression_engine.cpp`)
- CLI dispatcher → Polynomial input: builds polynomials (evidence: `main.cpp`)
- CLI dispatcher → Polynomial arithmetic: requests add or multiply (evidence: `main.cpp`)
- CLI dispatcher → History queue: records results (evidence: `main.cpp`)
- CLI dispatcher → History display: shows history (evidence: `README.md`)
- CLI dispatcher → History text: reads history snapshot (evidence: `main.cpp`)
- CLI dispatcher → Huffman codec: encodes or decodes (evidence: `main.cpp`)
- CLI dispatcher → Code table: shows codes (evidence: `README.md`)
- CLI dispatcher → Decoded output: prints decoded text (evidence: `main.cpp`)
- History text → History queue: dequeues snapshot (evidence: `main.cpp`)
- Polynomial input → Polynomial arithmetic: supplies operands (evidence: `data_storage.cpp`)
- Polynomial arithmetic → History queue: records operation (evidence: `data_storage.cpp`)
