# ridddle-en/bitcalc architecture

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

- Interactive diagram: https://gitdiagram.com/ridddle-en/bitcalc
- Repository: https://github.com/ridddle-en/bitcalc

## Overview

bitcalc is a single-file Bash command-line calculator. Users provide expressions as arguments or stdin, or use its interactive shell; the program performs bit-level arithmetic, logic, shifts, rotations, unary operations, and conversions, then presents results with working, flags, or result-only output. The README documents these capabilities and examples, but no source excerpts were available, so the internal decomposition and links are based only on that documentation.

Main entry points: [`src/bitcalc`](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc) (CLI Calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_cli["CLI Calculator"]
  node_expression["Expression Input"]
  node_interactive["Interactive Shell"]
end

subgraph group_operations["Bit Operations"]
  node_arithmetic["Arithmetic"]
  node_logic["Logic Operations"]
  node_shifts["Shifts and Rotates"]
  node_unary["Unary Operations"]
end

subgraph group_representation["Results and Conversion"]
  node_conversion["Base Conversion"]
  node_width["Width and Flags"]
  node_output["Result Output"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_user -->|"provides stdin"| node_expression
node_user -->|"starts"| node_interactive
node_cli -->|"accepts expressions"| node_expression
node_cli -->|"offers shell"| node_interactive
node_cli -->|"calculates"| node_arithmetic
node_cli -->|"calculates"| node_logic
node_cli -->|"calculates"| node_shifts
node_cli -->|"calculates"| node_unary
node_cli -->|"converts values"| node_conversion
node_cli -->|"applies width"| node_width
node_cli -->|"prints results"| node_output

click node_cli "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_expression "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_interactive "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_arithmetic "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_logic "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_shifts "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_unary "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_conversion "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_width "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"
click node_output "https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc"

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_expression,node_interactive,node_user toneBlue
class node_arithmetic,node_logic,node_shifts,node_unary toneAmber
class node_conversion,node_width,node_output toneMint
```

## Components

### Interaction

- [CLI Calculator](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Expression Input](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Interactive Shell](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`

### Bit Operations

- [Arithmetic](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Logic Operations](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Shifts and Rotates](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Unary Operations](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`

### Results and Conversion

- [Base Conversion](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Width and Flags](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`
- [Result Output](https://github.com/ridddle-en/bitcalc/blob/main/src/bitcalc): `src/bitcalc`

### Other components

- **User**

## Connections

- User → CLI Calculator: runs (evidence: `README.md`)
- User → Expression Input: provides stdin (evidence: `README.md`)
- User → Interactive Shell: starts (evidence: `README.md`)
- CLI Calculator → Expression Input: accepts expressions (evidence: `README.md`)
- CLI Calculator → Interactive Shell: offers shell (evidence: `README.md`)
- CLI Calculator → Arithmetic: calculates (evidence: `README.md`)
- CLI Calculator → Logic Operations: calculates (evidence: `README.md`)
- CLI Calculator → Shifts and Rotates: calculates (evidence: `README.md`)
- CLI Calculator → Unary Operations: calculates (evidence: `README.md`)
- CLI Calculator → Base Conversion: converts values (evidence: `README.md`)
- CLI Calculator → Width and Flags: applies width (evidence: `README.md`)
- CLI Calculator → Result Output: prints results (evidence: `README.md`)
