# arashiyama11/dncl_ide architecture

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

- Interactive diagram: https://gitdiagram.com/arashiyama11/dncl_ide
- Repository: https://github.com/arashiyama11/dncl_ide

## Overview

##### Project type and purpose
- This is a Kotlin Multiplatform-based Integrated Development Environment (IDE) project for a toy language (“DNCL”), plus accompanying CLI and Language Server components. The goal is to provide:
- Native and web-based IDE clients (ComposeApp for desktop/Android/JS, plus a SwiftUI-based iosApp)
- A command-line REPL and file runner (interpreter/CLI)
- A Language Server (LSP) for editor integrations

##### File structure
- Top-level modules:
- composeApp – the UI clients (desktop, Android, iOS, Web) built with Compose Multiplatform
- iosApp – a SwiftUI wrapper for iOS
- domain – core business logic: models, use cases, repository interfaces
- editor – code-editor component (text model, LSP client, UI adapters)
- interpreter – DNCL parser/evaluator/REPL for CLI and local execution
- language_server – standalone LSP server implementing DNCL language features
- build scripts, CI workflows, and redistribution packaging (CLI, IDE installers, web assets)
- Each KMP module splits into `commonMain` + platform-specific source sets (androidMain, desktopMain, wasmJsMain, nativeMain, iosMain).
- Tests accompany each module in a matching `commonTest` and platform test sets.

##### README for additional insights
- Describes available deliverables:
IDE installers for desktop/Android, web version (GitHub Pages), CLI binaries (+ JAR), Language Server JAR.
- Usage instructions reveal runtime relationships (IDE uses interpreter for running code locally; editors connect to language_server via stdio).

1. Frontend UI Clients
- ComposeApp (desktop, Android, Web)
- iosApp (SwiftUI)
2. Editor subsystem (the “editor” module)
3. Domain Core (domain models, use cases, repository interfaces)
4. Interpreter subsystem (interpreter module → CLI, REPL)
5. Language Server (language_server module)
6. File System & OS (external service)
- UI Clients ←→ Editor: user interactions (keystrokes, cursor movements) → Editor API → view updates
- Editor → Language Server: LSP requests/responses over stdio or websockets (for Web client)
- UI Clients (IDE) → Domain: state store, settings, file metadata via repository interfaces
- UI Clients (IDE) → Interpreter: trigger Evaluate/ExecuteUseCase → interpreter runs code → returns output
- Domain → Interpreter: ExecuteUseCase invokes interpreter’s evaluate pipeline
- Domain → File System: FileRepositoryImpl persists/loads notebooks and DNCL source
- Language Server → Domain: reuse use cases or own AST/semantic modules to serve LSP features
- C. Architectural patterns & design principles:
- Clean Architecture / Hexagonal:
– domain module defines pure business logic and interfaces
– interpreter and language_server are adapters/providers of behavior
– editor and ComposeApp are delivery mechanisms (UI adapters)
- Module boundaries enforced via Kotlin Multiplatform
- LSP abstraction in “language_server” and LSP client in “editor”
- Compose Multiplatform for UI unification across platforms
- D. Key technologies/frameworks:
- Kotlin Multiplatform (commonMain + platform sources)
- Jetpack Compose Multiplatform (composeApp UI)
- SwiftUI (iosApp)
- Language Server Protocol (language_server + editor/lsp)
- Custom DNCL lexer/parser/evaluator (interpreter)
- Gradle with Kotlin DSL for builds and distribution

## Diagram (Mermaid)

```mermaid
graph TB
    %% UI Layer
    subgraph "UI Layer"
        ComposeApp["ComposeApp UI\n(Desktop/Android/Web)"]:::ui
        iosApp["iosApp UI\n(SwiftUI)"]:::ui
    end

    %% Editor Layer
    subgraph "Editor Layer"
        Editor["Editor Module\n(Text Model & LSP client)"]:::editor
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Domain["Domain Core\n(Models, Use Cases, Repositories)"]:::domain
    end

    %% Adapter Layer
    subgraph "Adapter Layer"
        subgraph "Interpreter Subsystem"
            InterpreterCore["Interpreter\n(Parser & Evaluator)"]:::adapter
            InterpreterCLIDesktop["Interpreter CLI\nEntry (Desktop)"]:::adapter
            InterpreterCLINative["Interpreter CLI\nEntry (Native)"]:::adapter
        end
        subgraph "Language Server"
            LangServerCore["Language Server Core\nImplementation"]:::adapter
            LangServerDesktop["Language Server\nDesktop Entry"]:::adapter
        end
    end

    %% Infrastructure
    subgraph "Infrastructure"
        FileSystem["File System & OS"]:::infra
    end

    %% Connections
    ComposeApp -->|"User input"| Editor
    Editor -->|"View updates"| ComposeApp
    iosApp -->|"User input"| Editor
    Editor -->|"View updates"| iosApp

    Editor -->|"LSP request/response"| LangServerDesktop
    LangServerDesktop -->|"delegates to"| LangServerCore

    ComposeApp -->|"Uses"| Domain
    iosApp -->|"Uses"| Domain

    ComposeApp -->|"ExecuteUseCase"| InterpreterCLIDesktop
    Domain -->|"invokes"| InterpreterCore
    InterpreterCLIDesktop --> InterpreterCore
    InterpreterCLINative --> InterpreterCore

    Domain -->|"Read/Write files"| FileSystem

    LangServerCore -->|"Uses"| Domain

    %% Click Events
    click ComposeApp "https://github.com/arashiyama11/dncl_ide/tree/main/composeApp/"
    click iosApp "https://github.com/arashiyama11/dncl_ide/tree/main/iosApp/"
    click Editor "https://github.com/arashiyama11/dncl_ide/tree/main/editor/"
    click Domain "https://github.com/arashiyama11/dncl_ide/tree/main/domain/"
    click InterpreterCore "https://github.com/arashiyama11/dncl_ide/tree/main/interpreter/"
    click InterpreterCLIDesktop "https://github.com/arashiyama11/dncl_ide/blob/main/interpreter/src/desktopMain/kotlin/io/github/arashiyama11/dncl_ide/interpreter/Main.kt"
    click InterpreterCLINative "https://github.com/arashiyama11/dncl_ide/blob/main/interpreter/src/nativeMain/kotlin/io/github/arashiyama11/dncl_ide/interpreter/Main.kt"
    click LangServerCore "https://github.com/arashiyama11/dncl_ide/blob/main/language_server/src/commonMain/kotlin/io/github/arashiyama11/dncl_ide/language_server/DNCLLanguageServer.kt"
    click LangServerDesktop "https://github.com/arashiyama11/dncl_ide/blob/main/language_server/src/desktopMain/kotlin/io/github/arashiyama11/dncl_ide/language_server/Main.kt"
    click LangServerModule "https://github.com/arashiyama11/dncl_ide/tree/main/language_server/"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#2196F3;
    classDef editor fill:#BBDEFB,stroke:#1976D2;
    classDef domain fill:#E8F5E9,stroke:#388E3C;
    classDef adapter fill:#FFF3E0,stroke:#F57C00;
    classDef infra fill:#ECEFF1,stroke:#546E7A;
```
