# davio-2002/jsonparser architecture

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

- Interactive diagram: https://gitdiagram.com/davio-2002/jsonparser
- Repository: https://github.com/davio-2002/jsonparser

## Overview

##### Main Components Identification

a. Core Processing Layer
- Tokenizer
- Parser
- ErrorHandler

b. Model Layer (JSON Types)
- JsonValue (base class/interface)
- Concrete JSON types (Object, Array, String, Number, Boolean, Null)

c. Utilities Layer
- Utilities support functions

##### Specific Component Relationships

**Input JSON String → Tokenizer → Parser → Output JSON Structure**
- ↓     ↓
- ErrorHandler
- ↓
- Utilities

The model hierarchy should be shown as:
- JsonValue (Abstract)
- ↑
- ┌───┬───┬──┴──┬───┬───┬───┐
- Array Obj  Str  Num Bool Null

##### Implementation Notes

- The separation of concerns between tokenizing and parsing
- The extensible nature of the JsonValue hierarchy
- The central role of error handling throughout the system
- The support role of utilities

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IF[Input File]:::input
    end

    subgraph Core["Core Processing Pipeline"]
        FR["FileReader<br/>File & Stream Management"]:::core
        TK["Tokenizer<br/>Lexical Analysis"]:::core
        PR["Parser<br/>Syntax Analysis"]:::core
    end

    subgraph Output
        AST[Abstract Syntax Tree]:::output
    end

    subgraph Testing["Testing Layer"]
        TT["TokenizerTests"]:::test
        PT["ParserTests"]:::test
    end

    subgraph Build["Build System"]
        CM["CMake Build"]:::build
        MAIN["Main Application"]:::build
    end

    %% Main Flow
    IF --> |Raw Text| FR
    FR --> |Character Stream| TK
    TK --> |Tokens| PR
    PR --> |Parsed Data| AST

    %% Testing Relationships
    TT -.-> TK
    PT -.-> PR

    %% Build System
    CM --> FR
    CM --> TK
    CM --> PR
    CM --> MAIN

    %% Click Events
    click FR "https://github.com/Davio-2002/JsonParser/blob/master/include/core/FileReader.hpp"
    click TK "https://github.com/Davio-2002/JsonParser/blob/master/include/core/Tokenizer.hpp"
    click PR "https://github.com/Davio-2002/JsonParser/blob/master/include/core/Parser.hpp"
    click TT "https://github.com/Davio-2002/JsonParser/blob/master/tests/TokenizerTests.cpp"
    click PT "https://github.com/Davio-2002/JsonParser/blob/master/tests/ParserTests.cpp"
    click CM "https://github.com/Davio-2002/JsonParser/blob/master/CMakeLists.txt"
    click MAIN "https://github.com/Davio-2002/JsonParser/blob/master/src/main.cpp"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef input fill:#2ecc71,stroke:#27ae60,color:white
    classDef output fill:#2ecc71,stroke:#27ae60,color:white
    classDef test fill:#e67e22,stroke:#d35400,color:white
    classDef build fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Input/Output]:::input
        L3[Testing]:::test
        L4[Build System]:::build
    end
```
