# byly23/jolc_compiler architecture

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

- Interactive diagram: https://gitdiagram.com/byly23/jolc_compiler
- Repository: https://github.com/byly23/jolc_compiler

## Overview

##### Main Components
- User Interface Layer: This includes all the visual parts rendered in the browser. It contains the main pages (Inicio, Analizador, AstPage, etc.), the NavBar, and side bar components. Each of these is responsible for a section of the application.
- Code Editor & Visualization Modules: Components like CodeMirrorComponent for code editing, GraphvizComponent for rendering graphs (likely AST or other visual representations), and additional components for error and symbol data display.
- Routing Module: The routing logic (AppRouter.js) which manages navigation among pages.
- Style & Helper Modules: CSS directories and helper functions like getConsola.js for utility support.

##### Architectural Relationships and Interactions
- Client Browser: The user interacts with the application via a browser, which loads the entire SPA.
- Routing and Page Management: Once loaded, the AppRouter determines which page view to display based on the user’s navigation. Each page composes various components (for example, the Analizador page integrates CodeMirrorComponent for entering code and might trigger error analysis that then uses ErrData, SimData, etc.).
- Component Interactions: Components such as NavBar and SideBarData facilitate navigation and offer contextual menus/options that guide the user to other views.
- Data Processing Flow: The user's code input from the editor is processed (presumably sent to an analysis engine internally or via an external API – given the “compiler” theme). The results, such as errors (displayed in TablaErrores) or symbol tables (TablaSimbolos), then feed back into the UI. GraphvizComponent is used to render dynamic graphical representations (like ASTs), and there may be communication between pages/components to update that visualization in real-time.

##### Architectural Patterns and Design Principles
- Modular Component Design: The project is neatly divided into reusable React components and pages, a common pattern in front-end architecture for SPAs.
- Separation of Concerns: UI components (views, navigation, styles) are separated from utility modules (helpers) and configuration files (package.json, etc.).
- Single Page Application (SPA) Principles: The routing via AppRouter and centralized state management (if present) follow typical SPA principles.
- Standard Web Deployment: The application is hosted on Heroku (as evidenced by the link in the README) and uses a modular file structure common to modern web development.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Layer
    Browser("Browser (Client)"):::client

    %% Frontend SPA Container
    SPA("SPA Container"):::spa

    %% Subgraphs within SPA
    subgraph "Pages"
        Inicio("Inicio Page"):::page
        Analizador("Analizador Page"):::page
        AstPage("AstPage"):::page
        TablaErrores("TablaErrores Page"):::page
        TablaSimbolos("TablaSimbolos Page"):::page
    end

    subgraph "Common Components"
        NavBar("NavBar"):::component
        SideBar("SideBarData"):::component
    end

    subgraph "Modules"
        CodeEditor("CodeMirrorComponent"):::module
        Graphviz("GraphvizComponent"):::module
        ErrData("ErrData"):::module
        SimData("SimData"):::module
    end

    Routing("AppRouter"):::routing

    Helpers("Helper Functions & Styles"):::helper

    %% Global Connections
    Browser -->|"loads"| SPA

    %% Connections from SPA components
    NavBar -->|"triggers"| Routing
    SideBar -->|"triggers"| Routing

    Routing -->|"routes to"| Inicio
    Routing -->|"routes to"| Analizador
    Routing -->|"routes to"| AstPage
    Routing -->|"routes to"| TablaErrores
    Routing -->|"routes to"| TablaSimbolos

    %% Analizador Page internal components
    Analizador -->|"contains"| CodeEditor
    Analizador -->|"displays"| Graphviz
    Analizador -->|"displays"| ErrData
    Analizador -->|"displays"| SimData

    CodeEditor -->|"processes"| Graphviz

    %% Helper support connections
    Helpers ---|"supports"| NavBar
    Helpers ---|"supports"| SideBar
    Helpers ---|"supports"| CodeEditor
    Helpers ---|"supports"| Graphviz

    %% Click Events
    click Inicio "https://github.com/byly23/jolc_compiler/tree/master/frontend/src/pages"
    click Analizador "https://github.com/byly23/jolc_compiler/tree/master/frontend/src/pages"
    click AstPage "https://github.com/byly23/jolc_compiler/tree/master/frontend/src/pages"
    click TablaErrores "https://github.com/byly23/jolc_compiler/tree/master/frontend/src/pages"
    click TablaSimbolos "https://github.com/byly23/jolc_compiler/tree/master/frontend/src/pages"
    click NavBar "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/NavBar.js"
    click SideBar "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/SideBarData.js"
    click CodeEditor "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/CodeMirrorComponent.js"
    click Graphviz "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/GraphvizComponent.js"
    click ErrData "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/ErrData.js"
    click SimData "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/components/SimData.js"
    click Routing "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/routes/AppRouter.js"
    click Helpers "https://github.com/byly23/jolc_compiler/blob/master/frontend/src/helpers/getConsola.js"

    %% Styles
    classDef client fill:#ffeecc,stroke:#bb8800,stroke-width:2px;
    classDef spa fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef page fill:#cce5ff,stroke:#0044cc,stroke-width:2px;
    classDef component fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef module fill:#d5d5ff,stroke:#6666ff,stroke-width:2px;
    classDef routing fill:#e6ccff,stroke:#9933ff,stroke-width:2px;
    classDef helper fill:#e0e0e0,stroke:#808080,stroke-width:2px;
```
