# zmlsaggg/leksika architecture

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

- Interactive diagram: https://gitdiagram.com/zmlsaggg/leksika
- Repository: https://github.com/zmlsaggg/leksika

## Overview

Лексика is a Russian-language programming language; Лексус is its runtime and toolset. The documented desktop path runs `.lek` programs through the Python-based runtime, while the native C bootstrap supports a narrower compile-to-bytecode-and-VM path. The browser playground is a separate lightweight environment with an optional AI assistant. The README documents these product paths and capabilities; unsampled Python internals are represented at directory level, and no unshown calls between them are inferred.

Main entry points: [`playground-chat.js`](https://github.com/zmlsaggg/leksika/blob/main/playground-chat.js) (AI assistant), [`Leksika`](https://github.com/zmlsaggg/leksika/blob/main/Leksika) (Leksika command), [`ядро/лексус.c`](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BB%D0%B5%D0%BA%D1%81%D1%83%D1%81.c) (Native command), [`ядро/компилятор.c`](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%82%D0%BE%D1%80.c) (Native compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_cli["Leksika command"]
  node_python_runtime["Python runtime"]
  node_morphology["Russian morphology<br/>[морфология.lek]"]
  node_patches["Program patches<br/>[патчи.lek]"]
  node_language_ai["Language model<br/>[разум.lek]"]
end

subgraph group_native["Native engine"]
  node_native_cli["Native command<br/>[лексус.c]"]
  node_compiler["Native compiler<br/>[компилятор.c]"]
  node_bytecode["Bytecode and verifier<br/>[байткод.c]"]
  node_vm["Native VM<br/>[машина.c]"]
  node_values["Value model<br/>[значения.c]"]
  node_word_forms["Service word forms<br/>[словарь_формы.h]"]
  node_native_morphology["Noun morphology<br/>[морфология_имён.h]"]
end

subgraph group_lexicon["Language data"]
  node_lexicon_builder["Lexicon builder<br/>[словарь_сборщик.c]"]
  node_lexicon_index[("Lexicon index<br/>[словарь_индекс.c]")]
end

subgraph group_browser["Browser playground"]
  node_playground["Web playground<br/>[playground.js]"]
  node_chat_assistant["AI assistant<br/>[playground-chat.js]"]
end

node_developer(("Program author"))
node_playground_user(("Browser learner"))
node_hf_model["Hugging Face model"]
node_external_api["External AI API"]

node_developer -->|"runs programs"| node_cli
node_cli -->|"uses runtime"| node_python_runtime
node_developer -->|"runs subset"| node_native_cli
node_native_cli -->|"compiles source"| node_compiler
node_compiler -->|"emits bytecode"| node_bytecode
node_bytecode -->|"verified for execution"| node_vm
node_playground_user -->|"runs examples"| node_playground
node_playground -->|"offers assistant"| node_chat_assistant
node_chat_assistant -.->|"loads locally"| node_hf_model
node_chat_assistant -.->|"can connect"| node_external_api

click node_cli "https://github.com/zmlsaggg/leksika/blob/main/Leksika"
click node_python_runtime "https://github.com/zmlsaggg/leksika/tree/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0"
click node_morphology "https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D0%BC%D0%BE%D1%80%D1%84%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F.lek"
click node_patches "https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D0%BF%D0%B0%D1%82%D1%87%D0%B8.lek"
click node_language_ai "https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D1%80%D0%B0%D0%B7%D1%83%D0%BC.lek"
click node_native_cli "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BB%D0%B5%D0%BA%D1%81%D1%83%D1%81.c"
click node_compiler "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%82%D0%BE%D1%80.c"
click node_bytecode "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%B1%D0%B0%D0%B9%D1%82%D0%BA%D0%BE%D0%B4.c"
click node_vm "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BC%D0%B0%D1%88%D0%B8%D0%BD%D0%B0.c"
click node_values "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D1%8F.c"
click node_word_forms "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D1%84%D0%BE%D1%80%D0%BC%D1%8B.h"
click node_native_morphology "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BC%D0%BE%D1%80%D1%84%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F_%D0%B8%D0%BC%D1%91%D0%BD.h"
click node_lexicon_builder "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D1%81%D0%B1%D0%BE%D1%80%D1%89%D0%B8%D0%BA.c"
click node_lexicon_index "https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81.c"
click node_playground "https://github.com/zmlsaggg/leksika/blob/main/playground.js"
click node_chat_assistant "https://github.com/zmlsaggg/leksika/blob/main/playground-chat.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_python_runtime,node_morphology,node_patches,node_language_ai,node_playground_user toneBlue
class node_native_cli,node_compiler,node_bytecode,node_vm,node_values,node_word_forms,node_native_morphology toneAmber
class node_lexicon_builder,node_lexicon_index,node_external_api toneMint
class node_playground,node_chat_assistant toneRose
class node_developer,node_hf_model toneIndigo
```

## Components

### Desktop runtime

- [Leksika command](https://github.com/zmlsaggg/leksika/blob/main/Leksika): `Leksika`
- [Python runtime](https://github.com/zmlsaggg/leksika/tree/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0): `лексика`
- [Russian morphology](https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D0%BC%D0%BE%D1%80%D1%84%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F.lek): `лексика/морфология.lek`
- [Program patches](https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D0%BF%D0%B0%D1%82%D1%87%D0%B8.lek): `лексика/патчи.lek`
- [Language model](https://github.com/zmlsaggg/leksika/blob/main/%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D0%BA%D0%B0/%D1%80%D0%B0%D0%B7%D1%83%D0%BC.lek): `лексика/разум.lek`

### Native engine

- [Native command](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BB%D0%B5%D0%BA%D1%81%D1%83%D1%81.c): `ядро/лексус.c`
- [Native compiler](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%82%D0%BE%D1%80.c): `ядро/компилятор.c`
- [Bytecode and verifier](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%B1%D0%B0%D0%B9%D1%82%D0%BA%D0%BE%D0%B4.c): `ядро/байткод.c`
- [Native VM](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BC%D0%B0%D1%88%D0%B8%D0%BD%D0%B0.c): `ядро/машина.c`
- [Value model](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D1%8F.c): `ядро/значения.c`
- [Service word forms](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D1%84%D0%BE%D1%80%D0%BC%D1%8B.h): `ядро/словарь_формы.h`
- [Noun morphology](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D0%BC%D0%BE%D1%80%D1%84%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D1%8F_%D0%B8%D0%BC%D1%91%D0%BD.h): `ядро/морфология_имён.h`

### Language data

- [Lexicon builder](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D1%81%D0%B1%D0%BE%D1%80%D1%89%D0%B8%D0%BA.c): `ядро/словарь_сборщик.c`
- [Lexicon index](https://github.com/zmlsaggg/leksika/blob/main/%D1%8F%D0%B4%D1%80%D0%BE/%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81.c): `ядро/словарь_индекс.c`

### Browser playground

- [Web playground](https://github.com/zmlsaggg/leksika/blob/main/playground.js): `playground.js`
- [AI assistant](https://github.com/zmlsaggg/leksika/blob/main/playground-chat.js): `playground-chat.js`

### Other components

- **Program author**
- **Browser learner**
- **Hugging Face model**
- **External AI API**

## Connections

- Program author → Leksika command: runs programs (evidence: `README.md`)
- Leksika command → Python runtime: uses runtime (evidence: `README.md`)
- Program author → Native command: runs subset (evidence: `README.md`)
- Native command → Native compiler: compiles source (evidence: `README.md`)
- Native compiler → Bytecode and verifier: emits bytecode (evidence: `README.md`)
- Bytecode and verifier → Native VM: verified for execution (evidence: `README.md`)
- Browser learner → Web playground: runs examples (evidence: `README.md`)
- Web playground → AI assistant: offers assistant (evidence: `README.md`)
- AI assistant → Hugging Face model: loads locally (evidence: `README.md`)
- AI assistant → External AI API: can connect (evidence: `README.md`)
