# maude-lang/maude architecture

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

## Overview

##### Main Components Identification
The system can be broken down into these major components:

- Core Engine
- Theory Implementations
- Parser/Lexer
- Meta-level Facilities
- I/O and System Interface
- Strategy Language
- Built-in Modules

**Top Level (User Interface)**
**↓**
**Middle Level (Language Processing)**
**↓**
**Bottom Level (Core Engine)**

##### Component Details

A. Core Layer (Bottom)
- Connections to:
- Memory management
- Term representation
- Rewriting engine
- Equation handling

B. Theory Layer
- Different theory implementations:
- ACU (Associative-Commutative-Unit)
- CUI (Commutative-Unit-Identity)
- AU (Associative-Unit)
- Free Theory
- To the core engine

C. Processing Layer (Middle)
- Parser/Lexer components
- Strategy language processor
- Meta-level facilities
- Built-in module handlers

D. Interface Layer (Top)
- I/O management
- System interface
- Command processing
- Interactive features

##### Specific Implementation Details

- Rectangles: Major components
- Hexagons: Theory implementations

##### Key Relationships to Highlight

- How the Meta-level facilities interact with all other components
- Relationship between different theory implementations
- Demonstrate how the strategy language integrates with the core engine
- I/O and system interface connections

##### Additional Elements

Include:
- Version information (3.5)
- Main data flow paths
- Key external dependencies

##### Documentation Notes

Annotations for:
- Major version features
- Critical interfaces
- Performance-sensitive areas
- Extension points

- Multiple layers
- Export to high-resolution formats

Remember to maintain clarity while showing the complexity of the system, and ensure that the relationships between components are clearly visible.

This design should reflect Maude's nature as a high-performance reflective language system supporting both equational and rewriting logic specification and programming.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef core fill:#2b6cb0,color:white
    classDef theory fill:#48bb78,color:white
    classDef processing fill:#ecc94b,color:black
    classDef interface fill:#ed8936,color:white
    classDef utility fill:#a0aec0,color:white

    %% Interface Layer
    subgraph Interface
        IO["I/O Manager"]
        SYS["System Interface"]:::interface
        CMD["Command Processing"]:::interface
    end

    %% Processing Layer
    subgraph Processing
        PARSER["Parser/Lexer"]:::processing
        STRAT["Strategy Language"]:::processing
        META["Meta-level Facilities"]:::processing
        BUILTIN["Built-in Modules"]:::processing
        MIX["Mixfix Notation"]:::processing
    end

    %% Theory Layer
    subgraph Theories
        ACU["ACU Theory"]:::theory
        CUI["CUI Theory"]:::theory
        AU["AU Theory"]:::theory
        FREE["Free Theory"]:::theory
    end

    %% Core Layer
    subgraph Core
        CORE["Core Engine"]:::core
        MEM["Memory Management"]:::core
        TERM["Term Representation"]:::core
        REW["Rewriting Engine"]:::core
        EQ["Equation Handler"]:::core
        OBJ["Object System"]:::core
    end

    %% Relationships
    IO --> PARSER
    IO --> META
    SYS --> CORE
    CMD --> PARSER
    CMD --> STRAT

    PARSER --> CORE
    STRAT --> CORE
    META --> CORE
    BUILTIN --> CORE
    MIX --> PARSER

    ACU --> CORE
    CUI --> CORE
    AU --> CORE
    FREE --> CORE

    CORE --> MEM
    CORE --> TERM
    CORE --> REW
    CORE --> EQ
    CORE --> OBJ

    %% Click events
    click CORE "https://github.com/maude-lang/Maude/tree/master/src/Core/"
    click IO "https://github.com/maude-lang/Maude/blob/master/src/IO_Stuff/IO_Manager.cc"
    click PARSER "https://github.com/maude-lang/Maude/tree/master/src/Parser/"
    click META "https://github.com/maude-lang/Maude/tree/master/src/Meta/"
    click STRAT "https://github.com/maude-lang/Maude/tree/master/src/StrategyLanguage/"
    click BUILTIN "https://github.com/maude-lang/Maude/tree/master/src/BuiltIn/"
    click ACU "https://github.com/maude-lang/Maude/tree/master/src/ACU_Theory/"
    click CUI "https://github.com/maude-lang/Maude/tree/master/src/CUI_Theory/"
    click AU "https://github.com/maude-lang/Maude/tree/master/src/AU_Theory/"
    click FREE "https://github.com/maude-lang/Maude/tree/master/src/FreeTheory/"
    click MIX "https://github.com/maude-lang/Maude/tree/master/src/Mixfix/"
    click OBJ "https://github.com/maude-lang/Maude/tree/master/src/ObjectSystem/"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Theory Components"]:::theory
        L3["Processing Components"]:::processing
        L4["Interface Components"]:::interface
        L5["Utility Components"]:::utility
    end
```
