# tneverd/islamiccpp architecture

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

- Interactive diagram: https://gitdiagram.com/tneverd/islamiccpp
- Repository: https://github.com/tneverd/islamiccpp

## Overview

Islamic C++ is an educational C++17 interpreter for .icp programs. The documented workflow is to load a source file, tokenize it, parse tokens into an AST, and execute that tree, producing output. The runtime also supports variables and expressions, control flow, functions, collections, file operations, input, and system-information helpers. The main entry point and several interpreter features are excerpted; broader stage relationships and documented capabilities are grounded in the README, so unsampled internal dispatch details are not expanded.

Main entry points: [`Interpreter.cpp`](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp) (Interpreter), [`main.cpp`](https://github.com/tneverd/islamiccpp/blob/main/main.cpp) (File runner), [`Lexer.cpp`](https://github.com/tneverd/islamiccpp/blob/main/Lexer.cpp) (Lexer), [`Parser.cpp`](https://github.com/tneverd/islamiccpp/blob/main/Parser.cpp) (Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Source Front End"]
  node_cli["File runner<br/>[main.cpp]"]
  node_lexer["Lexer<br/>[Lexer.cpp]"]
  node_tokens["Token definitions<br/>[Token.h]"]
  node_parser["Parser<br/>[Parser.cpp]"]
end

subgraph group_syntax["Syntax Model"]
  node_ast["AST nodes<br/>[AST.h]"]
end

subgraph group_runtime["Execution Runtime"]
  node_interpreter["Interpreter<br/>[Interpreter.cpp]"]
  node_values["Values and expressions<br/>[Interpreter.cpp]"]
  node_control["Control and functions<br/>[Interpreter.cpp]"]
  node_collections["Collections and strings<br/>[Interpreter.cpp]"]
  node_system["System information<br/>[Interpreter.cpp]"]
end

subgraph group_io["Program I/O"]
  node_fileops["File operations<br/>[Interpreter.cpp]"]
  node_console["Console I/O<br/>[Interpreter.cpp]"]
end

node_author(("Program author"))
node_source["ICP source"]
node_output["Program output"]

node_author -->|"writes"| node_source
node_source -->|"runs as"| node_cli
node_cli -->|"creates"| node_lexer
node_lexer -->|"emits"| node_tokens
node_cli -->|"passes tokens"| node_parser
node_parser -->|"builds"| node_ast
node_cli -->|"evaluates tree"| node_interpreter
node_interpreter -->|"traverses"| node_ast
node_interpreter -->|"evaluates"| node_values
node_interpreter -->|"executes"| node_control
node_interpreter -->|"supports"| node_collections
node_interpreter -->|"queries"| node_system
node_interpreter -->|"performs"| node_fileops
node_interpreter -->|"uses"| node_console
node_interpreter -->|"produces"| node_output

click node_cli "https://github.com/tneverd/islamiccpp/blob/main/main.cpp"
click node_lexer "https://github.com/tneverd/islamiccpp/blob/main/Lexer.cpp"
click node_tokens "https://github.com/tneverd/islamiccpp/blob/main/Token.h"
click node_parser "https://github.com/tneverd/islamiccpp/blob/main/Parser.cpp"
click node_ast "https://github.com/tneverd/islamiccpp/blob/main/AST.h"
click node_interpreter "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_values "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_control "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_collections "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_system "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_fileops "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp"
click node_console "https://github.com/tneverd/islamiccpp/blob/main/Interpreter.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_lexer,node_tokens,node_parser toneBlue
class node_ast toneAmber
class node_interpreter,node_values,node_control,node_collections,node_system toneMint
class node_fileops,node_console toneRose
class node_author,node_source,node_output toneIndigo
```

## Components

### Source Front End

- [File runner](https://github.com/tneverd/islamiccpp/blob/main/main.cpp): `main.cpp`
- [Lexer](https://github.com/tneverd/islamiccpp/blob/main/Lexer.cpp): `Lexer.cpp`
- [Token definitions](https://github.com/tneverd/islamiccpp/blob/main/Token.h): `Token.h`
- [Parser](https://github.com/tneverd/islamiccpp/blob/main/Parser.cpp): `Parser.cpp`

### Syntax Model

- [AST nodes](https://github.com/tneverd/islamiccpp/blob/main/AST.h): `AST.h`

### Execution Runtime

- [Interpreter](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`
- [Values and expressions](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`
- [Control and functions](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`
- [Collections and strings](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`
- [System information](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`

### Program I/O

- [File operations](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`
- [Console I/O](https://github.com/tneverd/islamiccpp/blob/main/Interpreter.cpp): `Interpreter.cpp`

### Other components

- **Program author**
- **ICP source**
- **Program output**

## Connections

- Program author → ICP source: writes (evidence: `README.md`)
- ICP source → File runner: runs as (evidence: `README.md`)
- File runner → Lexer: creates (evidence: `main.cpp`)
- Lexer → Token definitions: emits (evidence: `Lexer.cpp`)
- File runner → Parser: passes tokens (evidence: `main.cpp`)
- Parser → AST nodes: builds (evidence: `README.md`)
- File runner → Interpreter: evaluates tree (evidence: `main.cpp`)
- Interpreter → AST nodes: traverses (evidence: `README.md`)
- Interpreter → Values and expressions: evaluates (evidence: `Interpreter.cpp`)
- Interpreter → Control and functions: executes (evidence: `README.md`)
- Interpreter → Collections and strings: supports (evidence: `Interpreter.cpp`)
- Interpreter → System information: queries (evidence: `Interpreter.cpp`)
- Interpreter → File operations: performs (evidence: `Interpreter.cpp`)
- Interpreter → Console I/O: uses (evidence: `README.md`)
- Interpreter → Program output: produces (evidence: `README.md`)
