# dj4n0/interprete_pyhtonlike architecture

> Architecture diagram of the GitHub repository dj4n0/interprete_pyhtonlike, 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/dj4n0/interprete_pyhtonlike
- Repository: https://github.com/dj4n0/interprete_pyhtonlike

## Overview

This is a standalone C++20 interpreter for a Python-like language subset. The evidenced workflow starts with a source-file argument, tokenizes the file, parses tokens into an AST, then executes the AST and prints results. The graph separates these stages from shared language representations and the command-line entry point. The sampled parser and interpreter show arithmetic, assignments, print, if/elif/else, and while behavior; broader capabilities suggested by the test names are not inferred from unsampled code.

Main entry points: [`main.cpp`](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/main.cpp) (Program entry), [`parser.cpp`](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/parser.cpp) (Syntax parsing), [`interpreter.cpp`](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/interpreter.cpp) (Statement execution), [`lexer.cpp`](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/lexer.cpp) (Lexical analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command-line entry"]
  node_main["Program entry<br/>[main.cpp]"]
end

subgraph group_front["Language front end"]
  node_lexer["Lexical analysis<br/>[lexer.cpp]"]
  node_parser["Syntax parsing<br/>[parser.cpp]"]
end

subgraph group_model["Language representations"]
  node_tokens["Token model<br/>[token.h]"]
  node_ast["AST nodes<br/>[ast.h]"]
  node_token_names["Token formatting<br/>[token.cpp]"]
end

subgraph group_runtime["Execution"]
  node_interpreter["Statement execution<br/>[interpreter.cpp]"]
end

node_user(("User"))
node_source["Source file"]
node_stdout(("Standard output"))

node_user -->|"provides argument"| node_main
node_source -->|"reads source"| node_lexer
node_main -->|"tokenizes file"| node_lexer
node_lexer -->|"emits tokens"| node_tokens
node_main -->|"parses tokens"| node_parser
node_parser -->|"consumes tokens"| node_tokens
node_parser -->|"builds nodes"| node_ast
node_main -->|"executes program"| node_interpreter
node_interpreter -->|"evaluates nodes"| node_ast
node_main -->|"formats token types"| node_token_names
node_token_names -->|"formats types"| node_tokens
node_interpreter -->|"prints results"| node_stdout

click node_main "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/main.cpp"
click node_lexer "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/lexer.cpp"
click node_parser "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/parser.cpp"
click node_tokens "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/token.h"
click node_ast "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/ast.h"
click node_token_names "https://github.com/dj4n0/interprete_pyhtonlike/blob/main/token.cpp"
click node_interpreter "https://github.com/dj4n0/interprete_pyhtonlike/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_main,node_user toneBlue
class node_lexer,node_parser toneAmber
class node_tokens,node_ast,node_token_names toneMint
class node_interpreter toneRose
class node_source,node_stdout toneIndigo
```

## Components

### Command-line entry

- [Program entry](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/main.cpp): `main.cpp`

### Language front end

- [Lexical analysis](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/lexer.cpp): `lexer.cpp`
- [Syntax parsing](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/parser.cpp): `parser.cpp`

### Language representations

- [Token model](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/token.h): `token.h`
- [AST nodes](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/ast.h): `ast.h`
- [Token formatting](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/token.cpp): `token.cpp`

### Execution

- [Statement execution](https://github.com/dj4n0/interprete_pyhtonlike/blob/main/interpreter.cpp): `interpreter.cpp`

### Other components

- **User**
- **Source file**
- **Standard output**

## Connections

- User → Program entry: provides argument (evidence: `main.cpp`)
- Source file → Lexical analysis: reads source (evidence: `lexer.cpp`)
- Program entry → Lexical analysis: tokenizes file (evidence: `main.cpp`)
- Lexical analysis → Token model: emits tokens (evidence: `lexer.cpp`)
- Program entry → Syntax parsing: parses tokens (evidence: `main.cpp`)
- Syntax parsing → Token model: consumes tokens (evidence: `parser.cpp`)
- Syntax parsing → AST nodes: builds nodes (evidence: `parser.cpp`)
- Program entry → Statement execution: executes program (evidence: `main.cpp`)
- Statement execution → AST nodes: evaluates nodes (evidence: `interpreter.cpp`)
- Program entry → Token formatting: formats token types (evidence: `main.cpp`)
- Token formatting → Token model: formats types (evidence: `token.cpp`)
- Statement execution → Standard output: prints results (evidence: `interpreter.cpp`)
