# haxscramper/haxorg architecture

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

- Interactive diagram: https://gitdiagram.com/haxscramper/haxorg
- Repository: https://github.com/haxscramper/haxorg

## Overview

##### Main Components

a. Core Processing Pipeline
- Base Lexer (Token Generation)
- Parser (AST Construction)
- Semantic Converter (DOM Processing)
- Exporters (Multiple Format Support)

b. Language Bindings
- Python API Layer (pybind11)
- Future C API Layer (planned)

c. Development Tools
- Testing Framework
- Code Generation Tools
- Documentation System

##### Component Relationships

**[Document Input] → [Processing Pipeline]**
- Lexer (src/haxorg/base_lexer)
- Parser (src/haxorg/parse)
- Semantic Analysis (src/haxorg/sem)
- ↓
**[Data Model] ←──→ [Export System]**
- ↑              ├─ JSON
- ↓              ├─ YAML
**[Bindings]        ├─ S-expressions**
- Python      └─ Other formats
- C (planned)

##### Key Design Elements

- Blue: Core C++ Components
- Green: Python Integration
- Yellow: Export Systems
- Gray: Planned Features
- Red: Critical Data Flow Paths

b. Component Groups:
- Processing Pipeline Components
- Standard Library Extensions (src/hstd)
- Binding Layer (src/py_libs)
- Tools and Utilities (scripts/)

##### Implementation Details to Highlight

- Reflection-based code generation system
- Test corpus feedback loop
- Demonstrate the export pipeline architecture
- GUI editor components (Qt-based)

##### Architecture Patterns

- Pipeline Processing Model
- Visitor Pattern for AST traversal
- Factory Pattern for exporters
- Command Pattern for CLI tools

##### Integration Points

- Third-party library connections
- Extension points
- API boundaries
- Document interop interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Core C++ Component]:::cpp
        L2[Python Component]:::python
        L3[Export Component]:::export
        L4[Planned Feature]:::planned
        L5[Critical Path]:::critical
    end

    subgraph "Processing Pipeline"
        Input[Document Input]:::critical
        Input --> Lexer
        
        subgraph "Core Processing"
            Lexer["Base Lexer"]:::cpp
            Parser["Parser"]:::cpp
            SemAnalysis["Semantic Analysis"]:::cpp
            
            Lexer --> Parser
            Parser --> SemAnalysis
        end
    end

    subgraph "Data Model"
        DOM["DOM/AST Structure"]:::cpp
        SemAnalysis --> DOM
    end

    subgraph "Export System"
        ExportBase["Export Base"]:::export
        JSON["JSON Export"]:::export
        YAML["YAML Export"]:::export
        SEXP["S-Expression Export"]:::export
        Other["Other Formats"]:::export
        
        DOM --> ExportBase
        ExportBase --> JSON
        ExportBase --> YAML
        ExportBase --> SEXP
        ExportBase --> Other
    end

    subgraph "Language Bindings"
        PythonAPI["Python API (pybind11)"]:::python
        CAPI["C API"]:::planned
        
        DOM --> PythonAPI
        DOM --> CAPI
    end

    subgraph "Development Tools"
        CodeGen["Code Generation"]:::cpp
        Testing["Testing Framework"]:::cpp
        Docs["Documentation"]:::cpp
        GUI["GUI Editor (Qt)"]:::cpp
        
        CodeGen --> Parser
        Testing --> DOM
        DOM --> GUI
    end

    classDef cpp fill:#a8d1f0,stroke:#0077be
    classDef python fill:#98fb98,stroke:#228b22
    classDef export fill:#ffeb99,stroke:#ffd700
    classDef planned fill:#d3d3d3,stroke:#808080
    classDef critical fill:#ffcccb,stroke:#ff0000

    click Lexer "https://github.com/haxscramper/haxorg/tree/master/src/haxorg/base_lexer/"
    click Parser "https://github.com/haxscramper/haxorg/tree/master/src/haxorg/parse/"
    click SemAnalysis "https://github.com/haxscramper/haxorg/tree/master/src/haxorg/sem/"
    click ExportBase "https://github.com/haxscramper/haxorg/tree/master/src/haxorg/exporters/"
    click PythonAPI "https://github.com/haxscramper/haxorg/tree/master/src/py_libs/pyhaxorg/"
    click CodeGen "https://github.com/haxscramper/haxorg/tree/master/scripts/py_codegen/"
    click Testing "https://github.com/haxscramper/haxorg/tree/master/tests/"
    click GUI "https://github.com/haxscramper/haxorg/tree/master/examples/imgui_gui/gui_lib/"
    click Docs "https://github.com/haxscramper/haxorg/tree/master/docs/"
```
