# blazeboyz0/kekno architecture

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

## Overview

Kekno is a C++ language interpreter. Its principal workflow accepts source in either a file or interactive session, compiles it into bytecode, then executes that bytecode in a VM. The graph also preserves the runtime value model and module-loading capability evident in the headers and VM excerpt. The README is empty; compiler and VM internals are only partially excerpted, so the graph omits unsupported feature-level call paths.

Main entry points: [`src/main.cpp`](https://github.com/blazeboyz0/kekno/blob/Main/src/main.cpp) (CLI and REPL), [`src/compiler.cpp`](https://github.com/blazeboyz0/kekno/blob/Main/src/compiler.cpp) (Compiler), [`src/vm.cpp`](https://github.com/blazeboyz0/kekno/blob/Main/src/vm.cpp) (Virtual machine), [`include/chunk.h`](https://github.com/blazeboyz0/kekno/blob/Main/include/chunk.h) (Chunk interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Source Front End"]
  node_cli["CLI and REPL<br/>[main.cpp]"]
  node_lexer["Lexer<br/>[lexer.cpp]"]
  node_tokens["Token definitions<br/>[token.h]"]
  node_lexer_api["Lexer interface<br/>[lexer.h]"]
end

subgraph group_compile["Bytecode Compilation"]
  node_compiler["Compiler<br/>[compiler.cpp]"]
  node_compiler_api["Compiler interface<br/>[compiler.h]"]
  node_bytecode["Bytecode chunk<br/>[chunk.cpp]"]
  node_chunk_api["Chunk interface<br/>[chunk.h]"]
  node_opcodes["Opcode set<br/>[opcode.h]"]
end

subgraph group_runtime["Runtime Execution"]
  node_vm["Virtual machine<br/>[vm.cpp]"]
  node_vm_api["VM interface<br/>[vm.h]"]
  node_modules["Module loading<br/>[vm.cpp]"]
end

subgraph group_model["Language Model"]
  node_values["Runtime values<br/>[value.h]"]
end

node_user(("Script author"))

node_user -->|"provides source"| node_cli
node_cli -->|"compiles source"| node_compiler
node_cli -->|"runs bytecode"| node_vm
node_compiler -->|"scans source"| node_lexer
node_lexer -->|"produces tokens"| node_tokens
node_compiler -->|"emits bytecode"| node_bytecode
node_bytecode -->|"stores constants"| node_values
node_chunk_api -->|"uses opcodes"| node_opcodes
node_compiler_api -->|"declares lexer"| node_lexer_api
node_compiler_api -->|"targets chunk"| node_chunk_api
node_vm_api -->|"accepts chunk"| node_chunk_api
node_vm_api -->|"uses values"| node_values
node_vm -->|"loads modules"| node_modules
node_vm -.->|"dispatches instructions"| node_opcodes

click node_cli "https://github.com/blazeboyz0/kekno/blob/Main/src/main.cpp"
click node_lexer "https://github.com/blazeboyz0/kekno/blob/Main/src/lexer.cpp"
click node_tokens "https://github.com/blazeboyz0/kekno/blob/Main/include/token.h"
click node_compiler "https://github.com/blazeboyz0/kekno/blob/Main/src/compiler.cpp"
click node_compiler_api "https://github.com/blazeboyz0/kekno/blob/Main/include/compiler.h"
click node_bytecode "https://github.com/blazeboyz0/kekno/blob/Main/src/chunk.cpp"
click node_chunk_api "https://github.com/blazeboyz0/kekno/blob/Main/include/chunk.h"
click node_opcodes "https://github.com/blazeboyz0/kekno/blob/Main/include/opcode.h"
click node_vm "https://github.com/blazeboyz0/kekno/blob/Main/src/vm.cpp"
click node_vm_api "https://github.com/blazeboyz0/kekno/blob/Main/include/vm.h"
click node_modules "https://github.com/blazeboyz0/kekno/blob/Main/src/vm.cpp"
click node_values "https://github.com/blazeboyz0/kekno/blob/Main/include/value.h"
click node_lexer_api "https://github.com/blazeboyz0/kekno/blob/Main/include/lexer.h"

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_lexer,node_tokens,node_lexer_api toneBlue
class node_compiler,node_compiler_api,node_bytecode,node_chunk_api,node_opcodes toneAmber
class node_vm,node_vm_api,node_modules toneMint
class node_values toneRose
class node_user toneIndigo
```

## Components

### Source Front End

- [CLI and REPL](https://github.com/blazeboyz0/kekno/blob/Main/src/main.cpp): `src/main.cpp`
- [Lexer](https://github.com/blazeboyz0/kekno/blob/Main/src/lexer.cpp): `src/lexer.cpp`
- [Token definitions](https://github.com/blazeboyz0/kekno/blob/Main/include/token.h): `include/token.h`
- [Lexer interface](https://github.com/blazeboyz0/kekno/blob/Main/include/lexer.h): `include/lexer.h`

### Bytecode Compilation

- [Compiler](https://github.com/blazeboyz0/kekno/blob/Main/src/compiler.cpp): `src/compiler.cpp`
- [Compiler interface](https://github.com/blazeboyz0/kekno/blob/Main/include/compiler.h): `include/compiler.h`
- [Bytecode chunk](https://github.com/blazeboyz0/kekno/blob/Main/src/chunk.cpp): `src/chunk.cpp`
- [Chunk interface](https://github.com/blazeboyz0/kekno/blob/Main/include/chunk.h): `include/chunk.h`
- [Opcode set](https://github.com/blazeboyz0/kekno/blob/Main/include/opcode.h): `include/opcode.h`

### Runtime Execution

- [Virtual machine](https://github.com/blazeboyz0/kekno/blob/Main/src/vm.cpp): `src/vm.cpp`
- [VM interface](https://github.com/blazeboyz0/kekno/blob/Main/include/vm.h): `include/vm.h`
- [Module loading](https://github.com/blazeboyz0/kekno/blob/Main/src/vm.cpp): `src/vm.cpp`

### Language Model

- [Runtime values](https://github.com/blazeboyz0/kekno/blob/Main/include/value.h): `include/value.h`

### Other components

- **Script author**

## Connections

- Script author → CLI and REPL: provides source (evidence: `src/main.cpp`)
- CLI and REPL → Compiler: compiles source (evidence: `src/main.cpp`)
- CLI and REPL → Virtual machine: runs bytecode (evidence: `src/main.cpp`)
- Compiler → Lexer: scans source
- Lexer → Token definitions: produces tokens (evidence: `src/lexer.cpp`)
- Compiler → Bytecode chunk: emits bytecode (evidence: `src/compiler.cpp`)
- Bytecode chunk → Runtime values: stores constants (evidence: `src/chunk.cpp`)
- Chunk interface → Opcode set: uses opcodes (evidence: `include/chunk.h`)
- Compiler interface → Lexer interface: declares lexer (evidence: `include/compiler.h`)
- Compiler interface → Chunk interface: targets chunk (evidence: `include/compiler.h`)
- VM interface → Chunk interface: accepts chunk (evidence: `include/vm.h`)
- VM interface → Runtime values: uses values (evidence: `include/vm.h`)
- Virtual machine → Module loading: loads modules (evidence: `src/vm.cpp`)
- Virtual machine → Opcode set: dispatches instructions
