# daeisbae/aparser architecture

> Architecture diagram of the GitHub repository daeisbae/aparser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daeisbae/aparser
- Repository: https://github.com/daeisbae/aparser

## Overview

##### Main Components

a) Input Processing Layer:
- File Reader (file/)
- String Utilities (stringutil/)

b) Lexical Analysis Layer:
- Lexer (lexer/)
- Token Management (token/)

c) Syntax Analysis Layer:
- Parser (parser/)
- Abstract Syntax Tree (ast/)
- Operator Handling (operator/)

d) Execution Layer:
- Runtime Environment (runtime/)

##### Component Relationships

a) Primary Flow:
Source Code → File Reader → Lexer → Parser → Runtime

b) Secondary Relationships:
- Token to Lexer (bidirectional as Lexer creates Tokens)
- AST to Parser (Parser creates AST nodes)
- Operator to both Parser and Runtime

**[Input Layer]**
- ↓
**[Lexical Analysis]**
- ↓
**[Syntax Analysis]**
- ↓
**[Execution Layer]**

##### Specific Design Elements

- Rectangles: Main components (Lexer, Parser, Runtime)
- Rounded rectangles: Support components (StringUtil, Token, Operator)
- Diamonds: Decision points or major transformations

- Blue: Input processing components
- Green: Lexical analysis components
- Yellow: Syntax analysis components
- Red: Runtime/execution components
- Gray: Utility components

##### Additional Details

Important elements:
- Version control integration (GitHub Actions)
- Testing framework connections
- Documentation generation (Doxygen)

##### Component Interactions

Detail the following flows:
**Source Code → File Reader**
- → StringUtil (for preprocessing)
- → Lexer (produces tokens)
- → Token (defines token types)
- → Parser (processes token stream)
- → AST (builds syntax tree)
- → Operator (handles operations)
- → Runtime (executes AST)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef input fill:#b3d9ff,stroke:#333
    classDef lexical fill:#90EE90,stroke:#333
    classDef syntax fill:#FFE5B4,stroke:#333
    classDef runtime fill:#FFB6C1,stroke:#333
    classDef utility fill:#E6E6E6,stroke:#333
    classDef testing fill:#FFF,stroke:#666,stroke-dasharray: 5 5
    classDef docs fill:#DDA0DD,stroke:#333
    classDef build fill:#D3D3D3,stroke:#333

    %% Input Layer
    subgraph InputLayer
        SRC[Source Code]
        FR["File Reader"]:::input
        SU["String Utilities"]:::input
    end

    %% Lexical Analysis Layer
    subgraph LexicalLayer
        LEX["Lexer"]:::lexical
        TOK["Token Management"]:::lexical
    end

    %% Syntax Analysis Layer
    subgraph SyntaxLayer
        PAR["Parser"]:::syntax
        AST["Abstract Syntax Tree"]:::syntax
        OP["Operator Handling"]:::syntax
    end

    %% Execution Layer
    subgraph ExecutionLayer
        RT["Runtime Environment"]:::runtime
    end

    %% Support Systems
    subgraph SupportSystems
        direction TB
        TEST["Testing Framework"]:::testing
        DOX["Documentation\nDoxygen"]:::docs
        CMAKE["Build System\nCMake"]:::build
        CI["CI/CD Pipeline"]:::build
    end

    %% Main Flow
    SRC --> FR
    FR --> SU
    SU --> LEX
    LEX --> PAR
    PAR --> RT

    %% Component Interactions
    LEX <--> TOK
    PAR <--> AST
    PAR <--> OP
    RT <--> OP

    %% Testing Connections
    TEST -.-> FR
    TEST -.-> LEX
    TEST -.-> PAR
    TEST -.-> RT

    %% Build and Documentation
    CMAKE --> FR
    CMAKE --> LEX
    CMAKE --> PAR
    CMAKE --> RT
    DOX --> FR
    DOX --> LEX
    DOX --> PAR
    DOX --> RT
    CI --> CMAKE
    CI --> DOX

    %% Click Events
    click FR "https://github.com/daeisbae/AParser/blob/main/file/file.hpp"
    click SU "https://github.com/daeisbae/AParser/blob/main/stringutil/stringutil.hpp"
    click LEX "https://github.com/daeisbae/AParser/blob/main/lexer/lexer.hpp"
    click TOK "https://github.com/daeisbae/AParser/blob/main/token/token.hpp"
    click PAR "https://github.com/daeisbae/AParser/blob/main/parser/parser.hpp"
    click AST "https://github.com/daeisbae/AParser/blob/main/ast/ast.hpp"
    click OP "https://github.com/daeisbae/AParser/blob/main/operator/operator.hpp"
    click RT "https://github.com/daeisbae/AParser/blob/main/runtime/runtime.hpp"
    click TEST "https://github.com/daeisbae/AParser/tree/main/testing"
    click DOX "https://github.com/daeisbae/AParser/tree/main/docs"
    click CMAKE "https://github.com/daeisbae/AParser/blob/main/CMakeLists.txt"
    click CI "https://github.com/daeisbae/AParser/tree/main/.github/workflows"

    %% Legend
    subgraph Legend
        direction TB
        L1["Input Processing"]:::input
        L2["Lexical Analysis"]:::lexical
        L3["Syntax Analysis"]:::syntax
        L4["Runtime"]:::runtime
        L5["Support Systems"]:::utility
        L6["Testing"]:::testing
    end
```
