# narayan-agarwal/python_mini architecture

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

- Interactive diagram: https://gitdiagram.com/narayan-agarwal/python_mini
- Repository: https://github.com/narayan-agarwal/python_mini

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% This diagram explains a simple virtual machine project in simple terms.
    %% There are four main parts:
    %% 1. REPL Interface: Takes user commands.
    %% 2. Virtual Machine Core: Keeps track of registers (AC, PC), memory, and the list of instructions.
    %% 3. Instruction Execution Unit: Executes individual instructions (CONST, LOAD, etc.).
    %% 4. Control Flow: Runs the loop that fetches instructions, executes them, and updates the state.
    
    subgraph "Main Architecture"
        REPL["REPL Interface (user commands)"]:::ui
        VMCore["Virtual Machine Core (AC, PC, Memory, Program)"]:::core
        IExec["Instruction Execution Unit (execute_instruction)"]:::exec
        ControlFlow["Control Flow (run loop: fetch-execute-update)"]:::control
    end
    
    REPL -->|"sendsCommands"| VMCore
    VMCore -->|"callsExecution"| IExec
    VMCore -->|"startsLoop"| ControlFlow
    ControlFlow -->|"fetchesInstruction"| VMCore
    IExec -->|"updatesState"| VMCore
    ControlFlow -.->|"handlesErrorsAndReset"| VMCore

    click REPL "https://github.com/narayan-agarwal/python_mini/blob/main/vm.py"
    click VMCore "https://github.com/narayan-agarwal/python_mini/blob/main/vm.py"
    click IExec "https://github.com/narayan-agarwal/python_mini/blob/main/vm.py"
    click ControlFlow "https://github.com/narayan-agarwal/python_mini/blob/main/vm.py"

    classDef ui fill:#f9c74f,stroke:#f9844a,stroke-width:2px;
    classDef core fill:#90be6d,stroke:#43aa8b,stroke-width:2px;
    classDef exec fill:#f94144,stroke:#f3722c,stroke-width:2px;
    classDef control fill:#577590,stroke:#277da1,stroke-width:2px;
```
