# vyogami/vadi architecture

> Architecture diagram of the GitHub repository vyogami/vadi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vyogami/vadi
- Repository: https://github.com/vyogami/vadi

## Overview

##### Main Components

a) REPL (Interactive Shell)
b) Interpreter Core Components:
- Lexer
- Parser
- Interpreter
c) Memory Management
d) Type System
e) Utility Components

##### Component Relationships

**User Input -> REPL -> Lexer -> Parser -> Interpreter -> Output**

**[User Input] → [REPL Interface]**

**[Lexer] → [Parser] → [Interpreter]**

**[Memory Manager]   [Type System]**
- ↑                ↑
- [Core Processing]────┘

##### Key Relationships to Highlight

- How the lexer breaks input into tokens (src/vadi/tokens.py)
- Parser's creation of the parse tree (src/vadi/parser.py)
- Demonstrate the interpreter's execution flow (src/vadi/interpreter.py)
- Memory management integration (src/vadi/memory.py)
- Type system interactions (src/vadi/typedef.py)

##### Additional Elements

- Version compatibility note (Python >=3.10)

##### Technical Details

- Recursive Descent Parsing technique
- Supported data types (Integer, Float)
- Variable declaration flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        UI[User Input]:::input
        REPL[REPL Interface]:::core
    end

    subgraph "Core Processing Pipeline"
        LEX[Lexer]:::core
        PAR[Parser]:::core
        INT[Interpreter]:::core
    end

    subgraph "Supporting Systems"
        MEM[Memory Manager]:::support
        TYPE[Type System]:::support
        TOK[Token Management]:::support
    end

    subgraph "Utility Layer"
        CONS[Console Utilities]:::util
        CONST[Constants]:::util
        HELP[Helper Functions]:::util
    end

    subgraph "Grammar Overview"
        GRM[BNF Notation]:::info
    end

    %% Main Flow
    UI --> REPL
    REPL --> LEX
    LEX --> PAR
    PAR --> INT
    INT --> OUT[Output]:::output

    %% Supporting Systems Connections
    LEX <--> TOK
    PAR <--> MEM
    INT <--> MEM
    INT <--> TYPE

    %% Utility Connections
    CONS --> REPL
    CONST -.-> LEX
    CONST -.-> PAR
    HELP -.-> INT

    %% Error Handling
    ERR[Error Handler]:::error
    LEX -.-> ERR
    PAR -.-> ERR
    INT -.-> ERR

    %% Click Events
    click REPL "https://github.com/vyogami/vadi/blob/main/src/vadi/repl.py"
    click LEX "https://github.com/vyogami/vadi/blob/main/src/vadi/lexer.py"
    click PAR "https://github.com/vyogami/vadi/blob/main/src/vadi/parser.py"
    click INT "https://github.com/vyogami/vadi/blob/main/src/vadi/interpreter.py"
    click MEM "https://github.com/vyogami/vadi/blob/main/src/vadi/memory.py"
    click TYPE "https://github.com/vyogami/vadi/blob/main/src/vadi/typedef.py"
    click TOK "https://github.com/vyogami/vadi/blob/main/src/vadi/tokens.py"
    click CONS "https://github.com/vyogami/vadi/blob/main/src/utils/console.py"
    click CONST "https://github.com/vyogami/vadi/blob/main/src/utils/constants.py"
    click HELP "https://github.com/vyogami/vadi/blob/main/src/utils/helpers.py"

    %% Styles
    classDef core fill:#2374ab,stroke:#2374ab,color:#fff
    classDef support fill:#ffd400,stroke:#ffd400,color:#000
    classDef util fill:#cccccc,stroke:#cccccc,color:#000
    classDef input fill:#34a853,stroke:#34a853,color:#fff
    classDef output fill:#34a853,stroke:#34a853,color:#fff
    classDef error fill:#ea4335,stroke:#ea4335,color:#fff
    classDef info fill:#f8f9fa,stroke:#dee2e6,color:#000

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Supporting Systems]:::support
        L3[Utilities]:::util
        L4[Input/Output]:::input
        L5[Error Handling]:::error
    end
```
