# axelbacke/kalkylatorcool architecture

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

- Interactive diagram: https://gitdiagram.com/axelbacke/kalkylatorcool
- Repository: https://github.com/axelbacke/kalkylatorcool

## Overview

Kalkylatorcool is a C++ expression calculator. Its visible workflow starts in the calculator entry point, converts infix input to postfix form, builds an expression tree, then exposes tree formatting and evaluation. The tree separates operand and operator abstractions from integer, real, and arithmetic implementations. The README is a generic GitLab template and documents no product capabilities. Source excerpts show construction and delegation boundaries; implementation details of the entry point and arithmetic classes were not excerpted.

Main entry points: [`Expression.cc`](https://github.com/axelbacke/kalkylatorcool/blob/main/Expression.cc) (Expression builder), [`Operator.h`](https://github.com/axelbacke/kalkylatorcool/blob/main/Operator.h) (Operator base), [`Operand.h`](https://github.com/axelbacke/kalkylatorcool/blob/main/Operand.h) (Operand base), [`Node.h`](https://github.com/axelbacke/kalkylatorcool/blob/main/Node.h) (Tree node API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_parse["Infix parsing"]
  node_tokenizer["Token reader<br/>[postfix.cc]"]
  node_postfix["Postfix converter<br/>[postfix.cc]"]
end

subgraph group_tree["Expression tree"]
  node_expression["Expression builder<br/>[Expression.cc]"]
  node_node["Tree node API<br/>[Node.h]"]
  node_operand["Operand base<br/>[Operand.h]"]
  node_operator["Operator base<br/>[Operator.h]"]
  node_integer["Integer operand<br/>[Integer.cc]"]
  node_real["Real operand<br/>[Real.cc]"]
  node_addition["Addition node<br/>[Addition.cc]"]
  node_subtraction["Subtraction node<br/>[Subtraction.cc]"]
  node_multiplication["Multiplication node<br/>[Multiplication.cc]"]
  node_division["Division node<br/>[Division.cc]"]
  node_power["Power node<br/>[Power.cc]"]
end

subgraph group_operations["Tree operations"]
  node_tree_results["Format and evaluate<br/>[Expression.cc]"]
end

node_user(("Calculator user"))
node_calculator["Calculator entry<br/>[Calculator.cc]"]

node_user -.->|"enters expression"| node_calculator
node_calculator -->|"constructs"| node_expression
node_expression -->|"converts infix"| node_postfix
node_postfix -->|"reads tokens"| node_tokenizer
node_expression -->|"builds integer"| node_integer
node_expression -->|"builds real"| node_real
node_expression -->|"builds addition"| node_addition
node_expression -->|"builds subtraction"| node_subtraction
node_expression -->|"builds multiplication"| node_multiplication
node_expression -->|"builds division"| node_division
node_expression -->|"builds power"| node_power
node_operand -->|"extends"| node_node
node_operator -->|"extends"| node_node
node_integer -->|"extends"| node_operand
node_real -->|"extends"| node_operand
node_addition -->|"extends"| node_operator
node_subtraction -->|"extends"| node_operator
node_multiplication -->|"extends"| node_operator
node_division -->|"extends"| node_operator
node_power -->|"extends"| node_operator
node_expression -->|"provides results"| node_tree_results
node_tree_results -->|"delegates to root"| node_node

click node_calculator "https://github.com/axelbacke/kalkylatorcool/blob/main/Calculator.cc"
click node_tokenizer "https://github.com/axelbacke/kalkylatorcool/blob/main/postfix.cc"
click node_postfix "https://github.com/axelbacke/kalkylatorcool/blob/main/postfix.cc"
click node_expression "https://github.com/axelbacke/kalkylatorcool/blob/main/Expression.cc"
click node_node "https://github.com/axelbacke/kalkylatorcool/blob/main/Node.h"
click node_operand "https://github.com/axelbacke/kalkylatorcool/blob/main/Operand.h"
click node_operator "https://github.com/axelbacke/kalkylatorcool/blob/main/Operator.h"
click node_integer "https://github.com/axelbacke/kalkylatorcool/blob/main/Integer.cc"
click node_real "https://github.com/axelbacke/kalkylatorcool/blob/main/Real.cc"
click node_addition "https://github.com/axelbacke/kalkylatorcool/blob/main/Addition.cc"
click node_subtraction "https://github.com/axelbacke/kalkylatorcool/blob/main/Subtraction.cc"
click node_multiplication "https://github.com/axelbacke/kalkylatorcool/blob/main/Multiplication.cc"
click node_division "https://github.com/axelbacke/kalkylatorcool/blob/main/Division.cc"
click node_power "https://github.com/axelbacke/kalkylatorcool/blob/main/Power.cc"
click node_tree_results "https://github.com/axelbacke/kalkylatorcool/blob/main/Expression.cc"

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_tokenizer,node_postfix,node_user toneBlue
class node_expression,node_node,node_operand,node_operator,node_integer,node_real,node_addition,node_subtraction,node_multiplication,node_division,node_power toneAmber
class node_tree_results toneMint
class node_calculator toneTeal
```

## Components

### Infix parsing

- [Token reader](https://github.com/axelbacke/kalkylatorcool/blob/main/postfix.cc): `postfix.cc`
- [Postfix converter](https://github.com/axelbacke/kalkylatorcool/blob/main/postfix.cc): `postfix.cc`

### Expression tree

- [Expression builder](https://github.com/axelbacke/kalkylatorcool/blob/main/Expression.cc): `Expression.cc`
- [Tree node API](https://github.com/axelbacke/kalkylatorcool/blob/main/Node.h): `Node.h`
- [Operand base](https://github.com/axelbacke/kalkylatorcool/blob/main/Operand.h): `Operand.h`
- [Operator base](https://github.com/axelbacke/kalkylatorcool/blob/main/Operator.h): `Operator.h`
- [Integer operand](https://github.com/axelbacke/kalkylatorcool/blob/main/Integer.cc): `Integer.cc`
- [Real operand](https://github.com/axelbacke/kalkylatorcool/blob/main/Real.cc): `Real.cc`
- [Addition node](https://github.com/axelbacke/kalkylatorcool/blob/main/Addition.cc): `Addition.cc`
- [Subtraction node](https://github.com/axelbacke/kalkylatorcool/blob/main/Subtraction.cc): `Subtraction.cc`
- [Multiplication node](https://github.com/axelbacke/kalkylatorcool/blob/main/Multiplication.cc): `Multiplication.cc`
- [Division node](https://github.com/axelbacke/kalkylatorcool/blob/main/Division.cc): `Division.cc`
- [Power node](https://github.com/axelbacke/kalkylatorcool/blob/main/Power.cc): `Power.cc`

### Tree operations

- [Format and evaluate](https://github.com/axelbacke/kalkylatorcool/blob/main/Expression.cc): `Expression.cc`

### Other components

- **Calculator user**
- [Calculator entry](https://github.com/axelbacke/kalkylatorcool/blob/main/Calculator.cc): `Calculator.cc`

## Connections

- Calculator user → Calculator entry: enters expression
- Calculator entry → Expression builder: constructs (evidence: `Calculator.cc`)
- Expression builder → Postfix converter: converts infix (evidence: `Expression.cc`)
- Postfix converter → Token reader: reads tokens (evidence: `postfix.cc`)
- Expression builder → Integer operand: builds integer (evidence: `Expression.cc`)
- Expression builder → Real operand: builds real (evidence: `Expression.cc`)
- Expression builder → Addition node: builds addition (evidence: `Expression.cc`)
- Expression builder → Subtraction node: builds subtraction (evidence: `Expression.cc`)
- Expression builder → Multiplication node: builds multiplication (evidence: `Expression.cc`)
- Expression builder → Division node: builds division (evidence: `Expression.cc`)
- Expression builder → Power node: builds power (evidence: `Expression.cc`)
- Operand base → Tree node API: extends (evidence: `Operand.h`)
- Operator base → Tree node API: extends (evidence: `Operator.h`)
- Integer operand → Operand base: extends
- Real operand → Operand base: extends
- Addition node → Operator base: extends
- Subtraction node → Operator base: extends
- Multiplication node → Operator base: extends
- Division node → Operator base: extends
- Power node → Operator base: extends
- Expression builder → Format and evaluate: provides results (evidence: `Expression.cc`)
- Format and evaluate → Tree node API: delegates to root (evidence: `Expression.cc`)
