# t9air/enlang architecture

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

## Overview

##### Main Components (represented as rectangles)
- Lexer (lexer.py)
- Parser (parser.py)
- Interpreter (interpreter.py)
- Main Program (main.py)
- Source File (.enl files)

##### Flow and Relationships
a. Source Code → Lexer → Parser → Interpreter → Program Execution

##### Processing Pipeline (from left to right)
- Lexer Component:
- Shows tokenization of source code

- Parser Component:
- Shows Abstract Syntax Tree (AST) generation

- Interpreter Component:
- Shows program execution

##### Control Flow
- Main Program Component:
- At the top, overseeing the process

##### Additional Elements
- Source code flow
- Token stream
- AST
- Execution results

- Processing stages:
- Lexical Analysis
- Syntactic Analysis
- Interpretation

Important Considerations:

## Diagram (Mermaid)

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#2b2b2b',
    'primaryTextColor': '#fff',
    'primaryBorderColor': '#7C0000',
    'lineColor': '#F8B229',
    'secondaryColor': '#006100',
    'tertiaryColor': '#fff'
  }
}}%%

flowchart TB
    title["enlang Interpreter Architecture"]

    subgraph Legend
        direction TB
        L1[Source Code]:::input --> L2[Token Stream]:::lexer
        L2 --> L3[AST]:::parser
        L3 --> L4[Execution]:::interpreter
    end

    subgraph Pipeline
        direction TB
        Source[".enl Source File"]:::input
        click Source "https://github.com/T9Air/enlang/blob/main/file.enl"
        
        Lexer["Lexer\nLexical Analysis"]:::lexer
        click Lexer "https://github.com/T9Air/enlang/blob/main/lexer.py"
        
        Parser["Parser\nSyntactic Analysis"]:::parser
        click Parser "https://github.com/T9Air/enlang/blob/main/parser.py"
        
        Interpreter["Interpreter\nProgram Execution"]:::interpreter
        click Interpreter "https://github.com/T9Air/enlang/blob/main/interpreter.py"
        
        Main["Main Program Controller"]:::controller
        click Main "https://github.com/T9Air/enlang/blob/main/main.py"
        
        Docs["Language Syntax\nDocumentation"]:::docs
        click Docs "https://github.com/T9Air/enlang/blob/main/syntax.md"
    end

    %% Connections
    Source -- "Source Code" --> Lexer
    Lexer -- "Token Stream" --> Parser
    Parser -- "AST" --> Interpreter
    
    Main -. "Controls" .-> Source
    Main -. "Controls" .-> Lexer
    Main -. "Controls" .-> Parser
    Main -. "Controls" .-> Interpreter
    
    Docs -. "Defines" .-> Source

    %% Styles
    classDef input fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef lexer fill:#90EE90,stroke:#333,stroke-width:2px
    classDef parser fill:#FFD700,stroke:#333,stroke-width:2px
    classDef interpreter fill:#FFA500,stroke:#333,stroke-width:2px
    classDef controller fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef docs fill:#DEB887,stroke:#333,stroke-width:2px
```
