# armoha/eudplib architecture

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

## Overview

##### Main Components

a. Core Components:
- EPScript Compiler (src/epscript)
- EUDPLib Core (src/eudplib/core)
- Read/Write System (src/eudplib/maprw)
- Memory I/O System (src/eudplib/memio)
- Rust Backend (src/rust)

b. Supporting Components:
- Collections Library (src/eudplib/collections)
- String Handling (src/eudplib/string)
- Trigger System (src/eudplib/trigger)
- StarCraft Data Handlers (src/eudplib/scdata)
- Utility Functions (src/eudplib/utils)

**┌─────────────────────────────────────────┐**
- User Interface             │
- (EPScript Language & Python API)     │
- ┤
- High-Level Features           │
- (Collections, String, Trigger System)  │
- ┤
- Core Systems               │
- (EUDPLib Core, Memory I/O, MapRW)    │
- ┤
- Native Backends              │
- (Rust Components, EPScript DLL)     │
- ┘

##### Key Relationships

a. Data Flow:
- EPScript source → Compiler → Python bytecode
- Data → MapRW → Core Systems
- Memory operations through the Rust backend

b. Dependencies:
- Core systems' reliance on native backends
- High-level features' usage of core systems
- String and trigger systems' integration

##### Additional Elements

- Component types
- Language indicators
- Special markers

b. Annotations for:
- File formats handled
- Key APIs
- Integration points
- Performance-critical paths

##### Implementation Details

- Clear hierarchical layout
- Consistent styling
- Proper spacing
- Readable fonts
- Detailed but uncluttered connections

##### Specific Component Details

a. EPScript Compiler:
- Lexer/parser pipeline
- Optimization stages
- Code generation points

b. Core Systems:
- Detail memory management
- Trigger processing
- Map manipulation flows

c. Native Backends:
- FFI boundaries
- Memory allocation systems
- Performance-critical paths

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef python fill:#3572A5,color:white
    classDef rust fill:#DEA584,color:black
    classDef cpp fill:#F34B7D,color:white
    classDef interface fill:#666666,color:white

    %% User Interface Layer
    subgraph UI
        EPScript["EPScript Compiler"]:::python
        PythonAPI["Python API"]:::python
    end

    %% High-Level Features Layer
    subgraph HighLevel
        Collections["Collections Library"]:::python
        StringHandler["String Handling"]:::python
        TriggerSystem["Trigger System"]:::python
        SCData["StarCraft Data Handlers"]:::python
        Utils["Utility Functions"]:::python
    end

    %% Core Systems Layer
    subgraph CoreSystems
        EUDPCore["EUDPLib Core"]:::python
        MemIO["Memory I/O System"]:::python
        MapRW["Map Read/Write System"]:::python
    end

    %% Native Backend Layer
    subgraph NativeBackend
        RustBackend["Rust Backend"]:::rust
        EPScriptDLL["EPScript DLL"]:::cpp
    end

    %% Relationships
    EPScript --> EUDPCore
    PythonAPI --> EUDPCore
    
    Collections --> EUDPCore
    StringHandler --> MemIO
    TriggerSystem --> EUDPCore
    SCData --> MapRW
    Utils --> EUDPCore
    
    EUDPCore --> RustBackend
    MemIO --> RustBackend
    MapRW --> RustBackend
    
    EUDPCore --> EPScriptDLL
    
    %% Click events for component mapping
    click EPScript "https://github.com/armoha/eudplib/tree/main/src/epscript/"
    click EUDPCore "https://github.com/armoha/eudplib/tree/main/src/eudplib/core/"
    click MapRW "https://github.com/armoha/eudplib/tree/main/src/eudplib/maprw/"
    click MemIO "https://github.com/armoha/eudplib/tree/main/src/eudplib/memio/"
    click RustBackend "https://github.com/armoha/eudplib/tree/main/src/rust/"
    click Collections "https://github.com/armoha/eudplib/tree/main/src/eudplib/collections/"
    click StringHandler "https://github.com/armoha/eudplib/tree/main/src/eudplib/string/"
    click TriggerSystem "https://github.com/armoha/eudplib/tree/main/src/eudplib/trigger/"
    click SCData "https://github.com/armoha/eudplib/tree/main/src/eudplib/scdata/"
    click Utils "https://github.com/armoha/eudplib/tree/main/src/eudplib/utils/"

    %% Legend
    subgraph Legend
        Python["Python Component"]:::python
        Rust["Rust Component"]:::rust
        CPP["C++ Component"]:::cpp
        Interface["Interface"]:::interface
    end
```
