# stevietelly/sql-validator architecture

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

- Interactive diagram: https://gitdiagram.com/stevietelly/sql-validator
- Repository: https://github.com/stevietelly/sql-validator

## Overview

##### Main Components

a) Input/Output Layer:
- SQL Statement Input
- Awino Code Output

b) Core Processing Components:
- Parser Module
- Lexer Module
- File Handling System
- Error Handling System

##### Component Relationships

**SQL Input → Parser → Lexer → Awino Code Output**

##### Detailed Component Breakdown

a) Parser Component (Parser/Parser.py):
- Input as SQL statements
- Tokenization process (breaking by comma, space, parenthesis)
- To the Lexer component

b) Lexer Component (Lexer/Lexer.py):
- Token processing
- Token type classification
- Primary/secondary value extraction
- To the output generation

c) Support Systems:
- Error Handling (var/Errors.py)
- File Handling (var/FileHandling.py)
- Object Management (var/Objects.py)

Use the following visual elements:

- Rounded rectangles: Support modules
- Diamonds: Decision points/validation
- Blue: Core processing components
- Green: Input/Output
- Yellow: Support systems
- Red: Error handling

##### Labels

a) Process Labels:
- "SQL Statement Input"
- "Tokenization"
- "Token Type Classification"
- "Value Extraction"
- "Awino Code Generation"

b) Data Format Labels:
- "Raw SQL"
- "Tokens"
- "Classified Tokens"
- "Awino Code Format: [Token Type]:[Primary Value]:[Secondary Value]"

##### Additional Elements

- Token Types (reference TOKENS.MD)
- Primary vs Secondary Values
- Error handling paths
- File handling interactions

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        SQL[SQL Statement Input]:::input
    end

    subgraph "Core Processing"
        Parser["Parser Module"]:::core
        Lexer["Lexer Module"]:::core
        Interpreter["Interpreter"]:::core
    end

    subgraph "Support Systems"
        ErrorHandler["Error Handling"]:::support
        FileHandler["File Handling"]:::support
        ObjManager["Object Management"]:::support
    end

    subgraph "Documentation"
        TokenDef["Token Definitions"]:::docs
        Grammar["SQL Grammar Rules"]:::docs
        Usage["Usage Guide"]:::docs
    end

    subgraph Output
        AwinoCode["Awino Code Output"]:::output
    end

    SQL --> Parser
    Parser --> Lexer
    Lexer --> Interpreter
    Interpreter --> AwinoCode

    Parser -.-> ErrorHandler
    Lexer -.-> ErrorHandler
    Parser -.-> FileHandler
    Lexer -.-> FileHandler
    Parser -.-> ObjManager
    Lexer -.-> ObjManager

    TokenDef -.-> Parser
    TokenDef -.-> Lexer
    Grammar -.-> Parser
    Usage -.-> Interpreter

    %% Click events for file mapping
    click Parser "https://github.com/stevietelly/SQL-Validator/blob/main/Parser/Parser.py"
    click Lexer "https://github.com/stevietelly/SQL-Validator/blob/main/Lexer/Lexer.py"
    click ErrorHandler "https://github.com/stevietelly/SQL-Validator/blob/main/var/Errors.py"
    click FileHandler "https://github.com/stevietelly/SQL-Validator/blob/main/var/FileHandling.py"
    click ObjManager "https://github.com/stevietelly/SQL-Validator/blob/main/var/Objects.py"
    click Interpreter "https://github.com/stevietelly/SQL-Validator/blob/main/Interpreter.py"
    click TokenDef "https://github.com/stevietelly/SQL-Validator/blob/main/TOKENS.MD"
    click Grammar "https://github.com/stevietelly/SQL-Validator/blob/main/GRAMAR.MD"
    click Usage "https://github.com/stevietelly/SQL-Validator/blob/main/USE.MD"

    %% Styling
    classDef input fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef support fill:#FFD700,stroke:#333,stroke-width:2px
    classDef output fill:#98FB98,stroke:#333,stroke-width:2px
    classDef docs fill:#DEB887,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Input/Output]:::input
        L2[Core Components]:::core
        L3[Support Systems]:::support
        L4[Documentation]:::docs
    end
```
