# domioking653/vertex architecture

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

- Interactive diagram: https://gitdiagram.com/domioking653/vertex
- Repository: https://github.com/domioking653/vertex
- Video tour (about a minute): https://gitdiagram.com/domioking653/vertex/video

## Overview

Vertex is an early-stage statically typed language that compiles source into bytecode and executes it in a virtual machine. The principal workflow is source tokenization, parsing into compilable program nodes, bytecode generation, and VM execution; the repository also has optimization, linking, bytecode persistence, compile-time checking, and built-in macros. The sampled code confirms parser and VM internals, but not the CLI orchestration or the wiring of several unsampled subsystems, so those connections are omitted.

Main entry points: [`src/backend/compiler/instructions.rs`](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/instructions.rs) (Instructions), [`src/backend/compiler/mod.rs`](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/mod.rs) (Bytecode Compiler), [`src/backend/ast/parser/parser_trait.rs`](https://github.com/domioking653/vertex/blob/main/src/backend/ast/parser/parser_trait.rs) (Parser), [`src/runtime/virtual_machine/vm.rs`](https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/vm.rs) (Virtual Machine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Language Frontend"]
  node_lexer["Tokenizer<br/>[tokenizer.rs]"]
  node_parser["Parser<br/>[parser_trait.rs]"]
  node_ast["AST Nodes"]
  node_errors["Diagnostics"]
end

subgraph group_compile["Compilation"]
  node_compiler["Bytecode Compiler<br/>[mod.rs]"]
  node_contexts["Compile Context"]
  node_macros["Built-in Macros"]
  node_optimizer["Optimizer<br/>[optimize.rs]"]
end

subgraph group_artifacts["Bytecode Artifacts"]
  node_instructions["Instructions<br/>[instructions.rs]"]
  node_linker["Object Linker<br/>[link.rs]"]
  node_persistence["Bytecode Saving<br/>[save.rs]"]
end

subgraph group_execute["Execution"]
  node_runner["VM Runner<br/>[mod.rs]"]
  node_loader["Bytecode Loader<br/>[pre_parsing.rs]"]
  node_vm["Virtual Machine<br/>[vm.rs]"]
  node_runtime_values["Runtime Values<br/>[value.rs]"]
  node_standard_library["Runtime Library<br/>[lib.rs]"]
end

node_programmer(("Programmer"))

node_programmer -->|"provides source"| node_lexer
node_lexer -->|"produces tokens"| node_parser
node_parser -->|"builds nodes"| node_ast
node_parser -->|"reports syntax errors"| node_errors
node_ast -->|"compiles nodes"| node_compiler
node_compiler -->|"checks compile-time state"| node_contexts
node_compiler -->|"emits instructions"| node_instructions
node_compiler -->|"reports compile errors"| node_errors
node_optimizer -->|"optimizes bytecode"| node_instructions
node_linker -->|"links objects"| node_instructions
node_persistence -->|"saves bytecode"| node_instructions
node_runner -->|"runs program"| node_vm
node_vm -->|"loads bytes"| node_loader
node_loader -->|"decodes bytecode"| node_instructions
node_vm -->|"uses values"| node_runtime_values

click node_lexer "https://github.com/domioking653/vertex/blob/main/src/backend/lexer/tokenizer.rs"
click node_parser "https://github.com/domioking653/vertex/blob/main/src/backend/ast/parser/parser_trait.rs"
click node_ast "https://github.com/domioking653/vertex/tree/main/src/backend/ast"
click node_errors "https://github.com/domioking653/vertex/tree/main/src/backend/errors"
click node_compiler "https://github.com/domioking653/vertex/blob/main/src/backend/compiler/mod.rs"
click node_contexts "https://github.com/domioking653/vertex/blob/main/src/backend/compiler/comptime_variable_checker/comptime_context.rs"
click node_macros "https://github.com/domioking653/vertex/tree/main/src/backend/buildin_macros"
click node_optimizer "https://github.com/domioking653/vertex/blob/main/src/backend/compiler/optimization/optimize.rs"
click node_instructions "https://github.com/domioking653/vertex/blob/main/src/backend/compiler/instructions.rs"
click node_linker "https://github.com/domioking653/vertex/blob/main/src/backend/linker/link.rs"
click node_persistence "https://github.com/domioking653/vertex/blob/main/src/backend/saving_bytes/save.rs"
click node_runner "https://github.com/domioking653/vertex/blob/main/src/runtime/runner/mod.rs"
click node_loader "https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/pre_parsing.rs"
click node_vm "https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/vm.rs"
click node_runtime_values "https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/value.rs"
click node_standard_library "https://github.com/domioking653/vertex/blob/main/src/runtime_lib/src/lib.rs"

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_lexer,node_parser,node_ast,node_errors toneBlue
class node_compiler,node_contexts,node_macros,node_optimizer toneAmber
class node_instructions,node_linker,node_persistence toneMint
class node_runner,node_loader,node_vm,node_runtime_values,node_standard_library toneRose
class node_programmer toneIndigo
```

## Components

### Language Frontend

- [Tokenizer](https://github.com/domioking653/vertex/blob/main/src/backend/lexer/tokenizer.rs): `src/backend/lexer/tokenizer.rs`
- [Parser](https://github.com/domioking653/vertex/blob/main/src/backend/ast/parser/parser_trait.rs): `src/backend/ast/parser/parser_trait.rs`
- [AST Nodes](https://github.com/domioking653/vertex/tree/main/src/backend/ast): `src/backend/ast`
- [Diagnostics](https://github.com/domioking653/vertex/tree/main/src/backend/errors): `src/backend/errors`

### Compilation

- [Bytecode Compiler](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/mod.rs): `src/backend/compiler/mod.rs`
- [Compile Context](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/comptime_variable_checker/comptime_context.rs): `src/backend/compiler/comptime_variable_checker/comptime_context.rs`
- [Built-in Macros](https://github.com/domioking653/vertex/tree/main/src/backend/buildin_macros): `src/backend/buildin_macros`
- [Optimizer](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/optimization/optimize.rs): `src/backend/compiler/optimization/optimize.rs`

### Bytecode Artifacts

- [Instructions](https://github.com/domioking653/vertex/blob/main/src/backend/compiler/instructions.rs): `src/backend/compiler/instructions.rs`
- [Object Linker](https://github.com/domioking653/vertex/blob/main/src/backend/linker/link.rs): `src/backend/linker/link.rs`
- [Bytecode Saving](https://github.com/domioking653/vertex/blob/main/src/backend/saving_bytes/save.rs): `src/backend/saving_bytes/save.rs`

### Execution

- [VM Runner](https://github.com/domioking653/vertex/blob/main/src/runtime/runner/mod.rs): `src/runtime/runner/mod.rs`
- [Bytecode Loader](https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/pre_parsing.rs): `src/runtime/virtual_machine/pre_parsing.rs`
- [Virtual Machine](https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/vm.rs): `src/runtime/virtual_machine/vm.rs`
- [Runtime Values](https://github.com/domioking653/vertex/blob/main/src/runtime/virtual_machine/value.rs): `src/runtime/virtual_machine/value.rs`
- [Runtime Library](https://github.com/domioking653/vertex/blob/main/src/runtime_lib/src/lib.rs): `src/runtime_lib/src/lib.rs`

### Other components

- **Programmer**

## Connections

- Programmer → Tokenizer: provides source
- Tokenizer → Parser: produces tokens
- Parser → AST Nodes: builds nodes
- Parser → Diagnostics: reports syntax errors
- AST Nodes → Bytecode Compiler: compiles nodes
- Bytecode Compiler → Compile Context: checks compile-time state
- Bytecode Compiler → Instructions: emits instructions
- Bytecode Compiler → Diagnostics: reports compile errors
- Optimizer → Instructions: optimizes bytecode
- Object Linker → Instructions: links objects
- Bytecode Saving → Instructions: saves bytecode
- VM Runner → Virtual Machine: runs program
- Virtual Machine → Bytecode Loader: loads bytes
- Bytecode Loader → Instructions: decodes bytecode
- Virtual Machine → Runtime Values: uses values
