# kommaddifayaz-lan/calc-x architecture

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

- Interactive diagram: https://gitdiagram.com/kommaddifayaz-lan/calc-x
- Repository: https://github.com/kommaddifayaz-lan/calc-x

## Overview

CALC-X is a menu-driven terminal calculator. The documented workflow is a user selecting a calculator or math tool in the main menu, entering values or an expression, and receiving a computed result. The README documents the menu-to-feature structure; sampled code confirms the expression evaluator and matrix and polynomial-calculus implementations. The tree also contains a MySQL history backend, but the available excerpts do not show how the menu invokes it. `project_files/` contains parallel copies; its database implementation is represented separately because it is a listed core module.

Main entry points: [`main.py`](https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py) (Menu and interaction), [`database.py`](https://github.com/kommaddifayaz-lan/calc-x/blob/main/database.py) (History operations), [`project_files/database.py`](https://github.com/kommaddifayaz-lan/calc-x/blob/main/project_files/database.py) (Project history operations), [`calculator.py`](https://github.com/kommaddifayaz-lan/calc-x/blob/main/calculator.py) (Expression evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Terminal interface"]
  node_menu["Menu and interaction<br/>[main.py]"]
end

subgraph group_calculators["Expression calculators"]
  node_basic_scientific["Basic and scientific<br/>[main.py]"]
  node_evaluator["Expression evaluator<br/>[calculator.py]"]
end

subgraph group_math_tools["Math tools"]
  node_algebra["Algebra solver<br/>[algebra.py]"]
  node_equations["Equation solver<br/>[equations.py]"]
  node_matrix["Matrix operations<br/>[matrix.py]"]
  node_statistics["Statistics<br/>[statistics.py]"]
  node_calculus["Polynomial calculus<br/>[calculus.py]"]
end

subgraph group_history["History storage"]
  node_history_ui["History interaction<br/>[main.py]"]
  node_mysql_history["History operations<br/>[database.py]"]
  node_mysql_copy["Project history operations<br/>[database.py]"]
end

node_user(("Calculator user"))
node_mysql[("MySQL database")]

node_user -->|"selects"| node_menu
node_menu -->|"routes to"| node_basic_scientific
node_menu -->|"routes to"| node_algebra
node_menu -->|"routes to"| node_equations
node_menu -->|"routes to"| node_matrix
node_menu -->|"routes to"| node_statistics
node_menu -->|"routes to"| node_calculus
node_menu -->|"routes to"| node_history_ui
node_basic_scientific -->|"evaluates with"| node_evaluator
node_user -->|"enters expression"| node_basic_scientific
node_mysql_history -->|"reads and writes"| node_mysql
node_mysql_copy -->|"reads and writes"| node_mysql

click node_menu "https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py"
click node_basic_scientific "https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py"
click node_evaluator "https://github.com/kommaddifayaz-lan/calc-x/blob/main/calculator.py"
click node_algebra "https://github.com/kommaddifayaz-lan/calc-x/blob/main/algebra.py"
click node_equations "https://github.com/kommaddifayaz-lan/calc-x/blob/main/equations.py"
click node_matrix "https://github.com/kommaddifayaz-lan/calc-x/blob/main/matrix.py"
click node_statistics "https://github.com/kommaddifayaz-lan/calc-x/blob/main/statistics.py"
click node_calculus "https://github.com/kommaddifayaz-lan/calc-x/blob/main/calculus.py"
click node_history_ui "https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py"
click node_mysql_history "https://github.com/kommaddifayaz-lan/calc-x/blob/main/database.py"
click node_mysql_copy "https://github.com/kommaddifayaz-lan/calc-x/blob/main/project_files/database.py"

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_menu,node_user toneBlue
class node_basic_scientific,node_evaluator,node_mysql toneAmber
class node_algebra,node_equations,node_matrix,node_statistics,node_calculus toneMint
class node_history_ui,node_mysql_history,node_mysql_copy toneRose
```

## Components

### Terminal interface

- [Menu and interaction](https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py): `main.py`

### Expression calculators

- [Basic and scientific](https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py): `main.py`
- [Expression evaluator](https://github.com/kommaddifayaz-lan/calc-x/blob/main/calculator.py): `calculator.py`

### Math tools

- [Algebra solver](https://github.com/kommaddifayaz-lan/calc-x/blob/main/algebra.py): `algebra.py`
- [Equation solver](https://github.com/kommaddifayaz-lan/calc-x/blob/main/equations.py): `equations.py`
- [Matrix operations](https://github.com/kommaddifayaz-lan/calc-x/blob/main/matrix.py): `matrix.py`
- [Statistics](https://github.com/kommaddifayaz-lan/calc-x/blob/main/statistics.py): `statistics.py`
- [Polynomial calculus](https://github.com/kommaddifayaz-lan/calc-x/blob/main/calculus.py): `calculus.py`

### History storage

- [History interaction](https://github.com/kommaddifayaz-lan/calc-x/blob/main/main.py): `main.py`
- [History operations](https://github.com/kommaddifayaz-lan/calc-x/blob/main/database.py): `database.py`
- [Project history operations](https://github.com/kommaddifayaz-lan/calc-x/blob/main/project_files/database.py): `project_files/database.py`

### Other components

- **Calculator user**
- **MySQL database**

## Connections

- Calculator user → Menu and interaction: selects (evidence: `README.md`)
- Menu and interaction → Basic and scientific: routes to (evidence: `README.md`)
- Menu and interaction → Algebra solver: routes to (evidence: `README.md`)
- Menu and interaction → Equation solver: routes to (evidence: `README.md`)
- Menu and interaction → Matrix operations: routes to (evidence: `README.md`)
- Menu and interaction → Statistics: routes to (evidence: `README.md`)
- Menu and interaction → Polynomial calculus: routes to (evidence: `README.md`)
- Menu and interaction → History interaction: routes to (evidence: `README.md`)
- Basic and scientific → Expression evaluator: evaluates with (evidence: `README.md`)
- Calculator user → Basic and scientific: enters expression (evidence: `README.md`)
- History operations → MySQL database: reads and writes (evidence: `database.py`)
- Project history operations → MySQL database: reads and writes (evidence: `project_files/database.py`)
