# ayxg/ssgc architecture

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

- Interactive diagram: https://gitdiagram.com/ayxg/ssgc
- Repository: https://github.com/ayxg/ssgc

## Overview

##### Project type and purpose
- This is a C++ “monorepo” packaging a full C& language environment: a compiler & VM, an IDE/CLI front‐end, extended standard libraries, meta‐template utilities, and a minimal testing framework.
- The goal is to allow you to build and deploy C& programs from command line or GUI, embed the IDE in a browser (future), and scale safely with metaprogramming.

##### File structure
- Top‐level CMakeLists.txt and CMakePresets.json orchestrate all subprojects in `projects/`.
- Under `projects/` you have:
- cide_box – the IDE / command‐line front end (CIDE executable + library)
- cnd_box – the C& Official Compiler & Virtual Machine (CAOCO)
- cxxx_box – C++ Extended Standard Library (CXX)
- mta_box – Meta Template Archive (MTA)
- minitest_box – Minimal C++ unit‐test framework (MINT)
- plus several supporting/demo libraries (caf_box, cgui_box, ssgmono_box, wpl_box, etc.)
- Each subproject follows the pattern: `inc/` for headers, `src/` for implementation, `test/` or `ut/` for tests, and uses its own CMakeLists.txt.

##### Key insights from the README
- It explicitly names the five main modules (CIDE, CAOCO, CXX, MTA, MINT) and their layering:
MTA → CXX → CAOCO → CIDE
(and MINT hooking into all for tests)
- External dependencies: ImGui‐SFML (temporary), Vulkan (future), browsers for embedding.

##### Main components and their relationships
- MTA: Meta Template Archive (pure header library)
- CXX: C++ Extended Standard Library (static library)
- CAOCO: Compiler + VM (library + CLI `cnd` executable)
- CIDE: IDE / CLI front end (GUI & CLI executables + cide library)
- MINT: Unit‐test harness (library + runner)
- External: ImGui‐SFML, SFML, CMake, VulkanAPI (future), Browser Embed
b. Dependencies & data flow
- MTA → CAOCO (compiler uses meta utilities)
- CXX → CAOCO (compiler may compile against extended std)
- CAOCO → CIDE (IDE invokes compiler API or spawns compiler process)
- ImGui‐SFML → CIDE (GUI layer)
- MINT → All subprojects (unit tests link their code into MINT runner)
c. Architectural patterns
- Monorepo with CMake multi‐project orchestration
- Layered libraries (each layer only depends on lower‐level layers)
- Plugin‐style front end (CIDE loads or calls compiler as a library or external tool)
- MVC‐like separation in CIDE: UI (ImGui widgets) vs Backend (build/compile tasks)
d. Major technologies & frameworks
- CMake for build and dependency management
- ImGui‐SFML for temporary GUI in CIDE
- SFML for windowing / input
- VulkanAPI / Browser (future embedding target)
- Standard C++17/20 and custom meta‐template utilities (MTA)

##### Final touches
- If space permits, show internal submodules: inside CAOCO, separate “Lexer/Parser”, “IR Generator”, “Codegen”, “Virtual Machine”.
- In CIDE, show “UI Module (ImGui)”, “Build Manager”, “Project Model (JSON)”, “Launcher” as subcomponents.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo container
    subgraph "Monorepo"
        direction TB

        %% Layer 1: MTA
        subgraph "Layer 1: MTA"
            direction TB
            MTA["MTA: Meta Template Archive"]:::coreLib
        end

        %% Layer 2: CXX
        subgraph "Layer 2: CXX"
            direction TB
            CXX["CXX: C++ Extended Standard Library"]:::coreLib
        end

        %% Layer 3: CAOCO
        subgraph "Layer 3: CAOCO (Compiler & VM)" 
            direction TB
            CAOCO["CAOCO: Compiler & VM"]:::coreLib
            subgraph "CAOCO Internals"
                direction TB
                Lex["Lexer/Parser"]:::coreLib
                IR["IR Generator"]:::coreLib
                Codegen["Codegen"]:::coreLib
                VM["Virtual Machine"]:::coreLib
            end
            CAOCO -->|build-time dependency| Lex
            CAOCO -->|build-time dependency| IR
            CAOCO -->|build-time dependency| Codegen
            CAOCO -->|build-time dependency| VM
        end

        %% Layer 4: CIDE
        subgraph "Layer 4: CIDE (IDE & CLI front end)"
            direction TB
            CIDE["CIDE: IDE/CLI"]:::exec
            subgraph "CIDE Submodules"
                direction TB
                UI["UI Module (ImGui)"]:::exec
                Build["Build Manager"]:::exec
                Model["Project Model (JSON)"]:::exec
                Launcher["Launcher"]:::exec
            end
            CIDE -->|internal module| UI
            CIDE -->|internal module| Build
            CIDE -->|internal module| Model
            CIDE -->|internal module| Launcher
        end

        %% Extensions & Demos (optional)
        subgraph "Extensions & Demos"
            direction TB
            Ext["caf_box, cgui_box, ssgmono_box, wpl_box"]:::coreLib
        end
    end

    %% Test harness
    MINT["MINT: Minimal Test Framework"]:::test

    %% External dependencies
    subgraph "External Dependencies"
        direction TB
        ImGui["ImGui-SFML"]:::external
        Vulkan["VulkanAPI (future)"]:::external
        Browser["Browser Embed (future)"]:::external
    end

    %% Dependencies arrows
    MTA -->|link-time dependency| CXX
    MTA -->|link-time dependency| CAOCO
    CXX -->|link-time dependency| CAOCO
    CAOCO -.->|runtime CLI invocation| CIDE
    ImGui -->|GUI layer| CIDE
    Vulkan -->|future renderer| CIDE
    Browser -->|future embed| CIDE

    %% Test harness links
    MINT -->|test-link| MTA
    MINT -->|test-link| CXX
    MINT -->|test-link| CAOCO
    MINT -->|test-link| CIDE
    MINT -->|test-link| Ext

    %% Click Events
    click MTA "https://github.com/ayxg/ssgc/blob/master/projects/mta_box/CMakeLists.txt"
    click CXX "https://github.com/ayxg/ssgc/blob/master/projects/cxxx_box/CMakeLists.txt"
    click CAOCO "https://github.com/ayxg/ssgc/blob/master/projects/cnd_box/CMakeLists.txt"
    click CIDE "https://github.com/ayxg/ssgc/blob/master/projects/cide_box/CMakeLists.txt"
    click MINT "https://github.com/ayxg/ssgc/blob/master/projects/minitest_box/CMakeLists.txt"

    %% Styles
    classDef coreLib fill:#e0ffe0,stroke:#2d8f2d,stroke-width:1px
    classDef exec fill:#e0f0ff,stroke:#0050a0,stroke-width:1px
    classDef external fill:#fff4e0,stroke:#a05d00,stroke-width:1px,stroke-dasharray: 5 5
    classDef test fill:#f0f0f0,stroke:#707070,stroke-width:1px,stroke-dasharray: 2 2
```
