# zairzrv/rust-scientific-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/zairzrv/rust-scientific-calculator
- Repository: https://github.com/zairzrv/rust-scientific-calculator

## Overview

A small Rust command-line scientific calculator: it prompts for operands and an operation, parses and validates input, dispatches to arithmetic functions, and prints results or errors in a repeat-until-quit loop. The runtime is implemented in one source file; no separate storage or external integrations are shown.

Main entry points: [`src/main.rs`](https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs) (REPL loop and banner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["CLI interaction"]
  node_main["REPL loop and banner<br/>[main.rs]"]
  node_input["Prompt and input parsing<br/>[main.rs]"]
end

subgraph group_math["Calculation"]
  node_dispatch["Operation selection<br/>[main.rs]"]
  node_operations["Arithmetic operations<br/>[main.rs]"]
end

node_user(("Calculator user"))

node_user -->|"starts program"| node_main
node_main -->|"runs interaction"| node_input
node_input -->|"parses operation"| node_dispatch
node_dispatch -->|"dispatches calculation"| node_operations
node_main -->|"prints result or error"| node_user

click node_main "https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs"
click node_input "https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs"
click node_dispatch "https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs"
click node_operations "https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs"

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_input,node_user toneBlue
class node_dispatch,node_operations toneAmber
```

## Components

### CLI interaction

- [REPL loop and banner](https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs): `src/main.rs`
- [Prompt and input parsing](https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs): `src/main.rs`

### Calculation

- [Operation selection](https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs): `src/main.rs`
- [Arithmetic operations](https://github.com/zairzrv/rust-scientific-calculator/blob/main/src/main.rs): `src/main.rs`

### Other components

- **Calculator user**

## Connections

- Calculator user → REPL loop and banner: starts program (evidence: `src/main.rs`)
- REPL loop and banner → Prompt and input parsing: runs interaction (evidence: `src/main.rs`)
- Prompt and input parsing → Operation selection: parses operation (evidence: `src/main.rs`)
- Operation selection → Arithmetic operations: dispatches calculation (evidence: `src/main.rs`)
- REPL loop and banner → Calculator user: prints result or error (evidence: `src/main.rs`)
