# sumitkarki188/compiler_final architecture

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

- Interactive diagram: https://gitdiagram.com/sumitkarki188/compiler_final
- Repository: https://github.com/sumitkarki188/compiler_final

## Overview

##### Project type and purpose
- This is a full-stack static code analyzer/compiler tool.
- The front end is a React Single-Page App (via Vite) that runs in the browser (deployed on Netlify).
- The back end is a Python web service (app.py) that orchestrates a compilation pipeline (lexical analysis, parsing, semantic checking in C via Flex/Bison, plus Python “utils” for linting, scoring, suggestions, and testing).

##### File structure
- Top level: FRONTEND/ and BACKEND/ folders, plus a README.md.
- FRONTEND/: a Vite-powered React project (package.json, src/, public/, build configs).
- BACKEND/:
- ErrorDetect/: the core compiler pipeline in C (lexical.l, parser.y, semantic.c/h).
- app.py: Python server entrypoint (likely Flask or FastAPI).
- utils/: auxiliary Python modules (language detection, linter, score, suggest, test).
- requirements.txt: Python dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client Side"
        U(("User")):::external
        subgraph "React SPA"
            A["React SPA"]:::frontend
            H["index.html"]:::frontend
            M["src/main.jsx"]:::frontend
            App["src/App.jsx"]:::frontend
            PKG["package.json"]:::frontend
            VITE["vite.config.js"]:::frontend
            PUB["public/"]:::frontend
        end
        U --> A
    end

    %% Static Hosting
    Netlify((Netlify)):::external
    H --> Netlify
    PUB --> Netlify
    Netlify --> A

    %% Server Side
    subgraph "Server Side"
        API["Flask API (app.py)"]:::service
        Req["requirements.txt"]:::service
        ED["ErrorDetect/"]:::service
        subgraph "Compiler Pipeline"
            Lex["lexical.l"]:::pipeline
            Parse["parser.y"]:::pipeline
            SemC["semantic.c"]:::pipeline
            SemH["semantic.h"]:::pipeline
            Rep["report.txt"]:::pipeline
        end
        subgraph "Python Utils"
            UTILS["utils/"]:::service
            Lang["language.py"]:::utils
            Lint["linter.py"]:::utils
            Sug["suggest.py"]:::utils
            Score["score.py"]:::utils
            Test["test.py"]:::utils
        end

        A -->|"HTTP POST /analyze"| API
        API --> Req
        API --> ED
        ED --> Lex
        Lex --> Parse
        Parse --> SemC
        Parse --> SemH
        SemC --> Rep
        SemH --> Rep
        Rep --> API
        API --> UTILS
        UTILS --> Lang
        Lang --> Lint
        Lint --> Sug
        Sug --> Score
        Score --> Test
        Test --> API
        API -->|"HTTP Response JSON"| A
    end

    %% Documentation & Config
    subgraph "Documentation"
        RD["README.md"]:::external
        FGI["FRONTEND/.gitignore"]:::external
        BGI["BACKEND/.gitignore"]:::external
        FRD["FRONTEND/README.md"]:::external
    end

    %% Click Events
    click H "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/index.html"
    click M "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/src/main.jsx"
    click App "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/src/App.jsx"
    click PKG "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/package.json"
    click VITE "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/vite.config.js"
    click PUB "https://github.com/sumitkarki188/compiler_final/tree/main/FRONTEND/public/"
    click API "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/app.py"
    click Req "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/requirements.txt"
    click ED "https://github.com/sumitkarki188/compiler_final/tree/main/BACKEND/ErrorDetect/"
    click Lex "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/ErrorDetect/lexical.l"
    click Parse "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/ErrorDetect/parser.y"
    click SemC "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/ErrorDetect/semantic.c"
    click SemH "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/ErrorDetect/semantic.h"
    click Rep "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/ErrorDetect/report.txt"
    click UTILS "https://github.com/sumitkarki188/compiler_final/tree/main/BACKEND/utils/"
    click Lang "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/utils/language.py"
    click Lint "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/utils/linter.py"
    click Sug "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/utils/suggest.py"
    click Score "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/utils/score.py"
    click Test "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/utils/test.py"
    click RD "https://github.com/sumitkarki188/compiler_final/blob/main/README.md"
    click FRD "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/README.md"
    click BGI "https://github.com/sumitkarki188/compiler_final/blob/main/BACKEND/.gitignore"
    click FGI "https://github.com/sumitkarki188/compiler_final/blob/main/FRONTEND/.gitignore"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef service fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef pipeline fill:#98FB98,stroke:#333,stroke-width:1px
    classDef utils fill:#FFD700,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
