# abstratt/simon architecture

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

- Interactive diagram: https://gitdiagram.com/abstratt/simon
- Repository: https://github.com/abstratt/simon

## Overview

##### Main Components and Architecture

The system should be represented as a multi-layered architecture with the following main components:

a. Core Layer:
- Metamodel (foundation)
- Compiler Infrastructure
- Parser Infrastructure

b. Implementation Layer:
- ANTLR-based Implementation
- Ecore Integration
- Annotation Processing

c. Extension Layer:
- Example Languages
- Testing Infrastructure

##### Component Relationships

a. Compilation Pipeline:
**Source Code → Parser → Compiler → Backend → Generated Model**

b. Metamodel Integration:
**Annotation DSL → Metamodel Definition ← Ecore Integration**

##### Detailed Component Breakdown

a. Core Components (Use solid rectangles):
- Metamodel (metamodel/)
- Compiler API (compiler/)
- Source API (compiler-source/)
- Backend API (compiler-backend/)

- ANTLR Parser (antlr-parser/)
- ANTLR Compiler (antlr-compiler/)
- Ecore Backend (compiler-backend-ecore/)
- Ecore Source (compiler-source-ecore/)
- Ecore Metamodel (metamodel-ecore/)

c. Support Components (Use rounded rectangles):
- Annotation DSL (annotation-dsl/)
- Annotation Processor (annotation-processor/)
- Generation Utilities (gen-utils/)

##### Interaction Flows

**Source → ANTLR Parser → Compiler → Backend → Model**

##### Additional Elements

Supporting elements:
- Version/build information
- Main external dependencies (ANTLR, Ecore)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Layer
    subgraph Core
        MM["Core Metamodel"]:::core
        CA["Compiler API"]:::core
        SA["Source API"]:::core
        BA["Backend API"]:::core
    end

    %% Implementation Layer
    subgraph Implementation
        AP["ANTLR Parser"]:::impl
        AC["ANTLR Compiler"]:::impl
        EB["Ecore Backend"]:::impl
        ES["Ecore Source"]:::impl
        EM["Ecore Metamodel"]:::impl
    end

    %% Support Layer
    subgraph Support
        AD["Annotation DSL"]:::support
        APR["Annotation Processor"]:::support
        GU["Generation Utils"]:::support
    end

    %% Extension Layer
    subgraph Extensions
        EL["Example Languages"]:::ext
        ELK["Example Languages Kotlin"]:::ext
        TI["Testing Infrastructure"]:::ext
    end

    %% Relationships
    MM --> CA
    MM --> SA
    MM --> BA
    
    AP --> AC
    AC --> MM
    
    EB --> BA
    ES --> SA
    EM --> MM
    
    AD --> APR
    APR --> MM
    GU --> AC
    
    EL --> MM
    ELK --> MM
    TI --> MM

    %% Click Events
    click MM "https://github.com/abstratt/simon/blob/master/metamodel/src/main/java/com/abstratt/simon/metamodel/Metamodel.java"
    click CA "https://github.com/abstratt/simon/blob/master/compiler/src/main/java/com/abstratt/simon/compiler/SimonCompiler.java"
    click AP "https://github.com/abstratt/simon/tree/master/antlr-parser/"
    click AC "https://github.com/abstratt/simon/tree/master/antlr-compiler/"
    click EB "https://github.com/abstratt/simon/tree/master/compiler-backend-ecore/"
    click ES "https://github.com/abstratt/simon/tree/master/compiler-source-ecore/"
    click EM "https://github.com/abstratt/simon/tree/master/metamodel-ecore/"
    click AD "https://github.com/abstratt/simon/tree/master/annotation-dsl/"
    click APR "https://github.com/abstratt/simon/blob/master/annotation-processor/src/main/java/com/abstratt/simon/tooling/SimonDSLProcessor.java"
    click EL "https://github.com/abstratt/simon/tree/master/example-languages/"
    click ELK "https://github.com/abstratt/simon/tree/master/example-languages-kotlin/"
    click TI "https://github.com/abstratt/simon/tree/master/tests/"
    click GU "https://github.com/abstratt/simon/tree/master/gen-utils/"
    click BA "https://github.com/abstratt/simon/blob/master/compiler-backend/src/main/java/com/abstratt/simon/compiler/backend/Backend.java"
    click SA "https://github.com/abstratt/simon/blob/master/compiler-source/src/main/java/com/abstratt/simon/compiler/source/SourceProvider.java"

    %% Styles
    classDef core fill:#b3d1ff,stroke:#4d88ff,stroke-width:2px
    classDef impl fill:#b3ffb3,stroke:#4dff4d,stroke-width:2px,stroke-dasharray: 5 5
    classDef support fill:#ffd9b3,stroke:#ffb366,stroke-width:2px,rx:10,ry:10
    classDef ext fill:#e6e6e6,stroke:#808080,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["Implementation"]:::impl
        L3["Support Tool"]:::support
        L4["Extension"]:::ext
    end
```
