# svark/tuprs architecture

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

## Overview

- Input Files → Parser Module
- Parser Module → Decoder Module
- Decoder Module → Statement Processor
- Statement Processor → Transform Module
- Transform Module → Resolved Output

- How Buffer Management interfaces with Parser
- Path Resolution connecting to multiple components
- Error Handling spanning across all components
- Platform-specific Logic influencing parsing decisions

##### Important Details

- Clear indication of entry points (TupParser::new() and parse_dir)
- Resolution mechanism
- File system interaction points
- Error propagation paths
- Platform-specific branching

Top: Input Layer
Middle: Core Processing
Bottom: Output Layer
Right Side: Support Services
Left Side: Configuration Management

##### Additional Elements

- Version compatibility notes
- Integration points with external Tup system
- Test coverage areas

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef support fill:#FFE5B4,stroke:#000
    classDef output fill:#DDA0DD,stroke:#000
    classDef error fill:#FFB6C1,stroke:#000
    classDef config fill:#D3D3D3,stroke:#000

    %% Input Layer
    subgraph InputLayer
        TF[Tupfile Parser]:::input
        LP[Lua Parser]:::input
        CP[Config Parser]:::input
    end

    %% Core Processing Layer
    subgraph CoreLayer
        PM[Parser Module]:::core
        DM[Decoder Module]:::core
        SP[Statement Processor]:::core
        TM[Transform Module]:::core
    end

    %% Support Systems
    subgraph SupportLayer
        BM[Buffer Management]:::support
        PR[Path Resolution]:::support
        SI[String Internment]:::support
        EH[Error Handling]:::error
        PL[Platform-specific Logic]:::config
    end

    %% Output Layer
    subgraph OutputLayer
        RR[Resolved Rules]:::output
        DG[Dependencies Graph]:::output
        BI[Build Instructions]:::output
    end

    %% Relationships
    TF --> PM
    LP --> PM
    CP --> PM
    PM --> DM
    DM --> SP
    SP --> TM
    TM --> RR
    TM --> DG
    TM --> BI

    %% Support Service Connections
    BM -.-> PM
    PR -.-> PM
    PR -.-> SP
    SI -.-> DM
    EH -.-> PM
    EH -.-> DM
    EH -.-> SP
    EH -.-> TM
    PL -.-> SP

    %% Click Events
    click PM "https://github.com/svark/tuprs/blob/main/lib/parser.rs"
    click DM "https://github.com/svark/tuprs/blob/main/lib/decode.rs"
    click SP "https://github.com/svark/tuprs/blob/main/lib/statements.rs"
    click TM "https://github.com/svark/tuprs/blob/main/lib/transform.rs"
    click BM "https://github.com/svark/tuprs/blob/main/lib/buffers.rs"
    click PR "https://github.com/svark/tuprs/blob/main/lib/paths.rs"
    click SI "https://github.com/svark/tuprs/blob/main/lib/intern.rs"
    click EH "https://github.com/svark/tuprs/blob/main/lib/errors.rs"
    click PL "https://github.com/svark/tuprs/blob/main/lib/platform.rs"
    click LP "https://github.com/svark/tuprs/blob/main/lib/scriptloader.rs"

    %% Legend
    subgraph Legend
        I[Input Components]:::input
        C[Core Components]:::core
        S[Support Services]:::support
        O[Output Components]:::output
        E[Error Handling]:::error
        CF[Configuration]:::config
    end
```
