# rycont/dalbit-yaksok architecture

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

- Interactive diagram: https://gitdiagram.com/rycont/dalbit-yaksok
- Repository: https://github.com/rycont/dalbit-yaksok

## Overview

##### Main Components Identification
The project is a programming language implementation with these key components:

a) Core Runtime Engine
- Parser/Lexer (core/prepare/)
- Executor (core/executer/)
- Node System (core/node/)
- Value System (core/value/)
- Error Handling (core/error/)

b) Integration Components
- Monaco Language Provider (IDE support)
- QuickJS Bridge (JavaScript translation)
- Documentation System

**┌─ User Interface Layer ─────────────────────┐**
- Monaco Editor Integration                │
- Web Documentation                        │
- ┬───────────────────────┘
- ↓
**┌─ Language Processing Layer ────────────────┐**
- ┌─────────┐  ┌──────────┐  ┌────────────┐ │
- Lexer   │→ │ Parser   │→ │ AST Nodes  │ │
- ┘  └──────────┘  └────────────┘ │
- ┬───────────────────────┘
- ↓
**┌─ Execution Layer ──────────────────────────┐**
- ┌─────────┐  ┌──────────┐  ┌────────────┐ │
- Executor │← │ Runtime  │← │ Value      │ │
- Scope    │  │ System     │ │
- ┘  └──────────┘  └────────────┘ │
- ┬───────────────────────┘
- ↓
**┌─ Integration Layer ────────────────────────┐**
- QuickJS Bridge                          │
- FFI (Foreign Function Interface)        │
- ┘

##### Important Relationships to Highlight

a) Core Processing Flow:
- Text → tokens → AST → execution pipeline
- Error handling paths across all stages

b) Integration Points:
- Monaco Editor ↔ Language Server Protocol
- QuickJS Bridge ↔ JavaScript Runtime
- FFI System ↔ External Functions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#e1f5fe,stroke:#01579b
    classDef core fill:#e8f5e9,stroke:#1b5e20
    classDef integration fill:#fff3e0,stroke:#e65100
    classDef error fill:#ffebee,stroke:#b71c1c

    %% UI Layer
    subgraph UI["User Interface Layer"]
        MonacoEditor["Monaco Editor Integration"]
        Documentation["Documentation System"]
    end

    %% Language Processing Layer
    subgraph LangProc["Language Processing Layer"]
        Lexer["Lexer/Tokenizer"]:::core
        Parser["Parser"]:::core
        ASTNodes["AST Nodes"]:::core
        DynamicRule["Dynamic Rule System"]:::core
    end

    %% Execution Layer
    subgraph Exec["Execution Layer"]
        Executor["Executor"]:::core
        RuntimeScope["Runtime Scope"]:::core
        ValueSystem["Value System"]:::core
        FunctionTemplate["Function Template"]:::core
        MentionSystem["Mention System"]:::core
    end

    %% Integration Layer
    subgraph Integration["Integration Layer"]
        QuickJS["QuickJS Bridge"]:::integration
        FFI["Foreign Function Interface"]:::integration
    end

    %% Error Handling (crosses all layers)
    ErrorSystem["Error Handling System"]:::error

    %% Relationships
    MonacoEditor --> Lexer
    Documentation --> Lexer
    Lexer --> Parser
    Parser --> ASTNodes
    Parser --> DynamicRule
    DynamicRule --> ASTNodes
    ASTNodes --> Executor
    Executor --> RuntimeScope
    Executor --> ValueSystem
    Executor --> FunctionTemplate
    Executor --> MentionSystem
    RuntimeScope --> QuickJS
    QuickJS --> FFI
    
    %% Error System Connections
    ErrorSystem --> Lexer
    ErrorSystem --> Parser
    ErrorSystem --> Executor
    ErrorSystem --> QuickJS

    %% Click Events
    click Lexer "https://github.com/rycont/dalbit-yaksok/tree/main/core/prepare/lex/"
    click Parser "https://github.com/rycont/dalbit-yaksok/tree/main/core/prepare/parse/"
    click Executor "https://github.com/rycont/dalbit-yaksok/tree/main/core/executer/"
    click RuntimeScope "https://github.com/rycont/dalbit-yaksok/blob/main/core/executer/scope.ts"
    click ASTNodes "https://github.com/rycont/dalbit-yaksok/tree/main/core/node/"
    click ValueSystem "https://github.com/rycont/dalbit-yaksok/tree/main/core/value/"
    click ErrorSystem "https://github.com/rycont/dalbit-yaksok/tree/main/core/error/"
    click MonacoEditor "https://github.com/rycont/dalbit-yaksok/tree/main/monaco-language-provider/"
    click QuickJS "https://github.com/rycont/dalbit-yaksok/tree/main/quickjs/"
    click DynamicRule "https://github.com/rycont/dalbit-yaksok/tree/main/core/prepare/parse/dynamicRule/"
    click FunctionTemplate "https://github.com/rycont/dalbit-yaksok/blob/main/core/type/function-template.ts"
    click MentionSystem "https://github.com/rycont/dalbit-yaksok/blob/main/core/node/mention.ts"
    click Documentation "https://github.com/rycont/dalbit-yaksok/tree/main/docs/"

    %% Legend
    subgraph Legend
        UI_Legend["UI Components"]:::ui
        Core_Legend["Core Components"]:::core
        Integration_Legend["Integration Components"]:::integration
        Error_Legend["Error Handling"]:::error
    end
```
