# tiline471-code/xzero-v1 architecture

> Architecture diagram of the GitHub repository tiline471-code/xzero-v1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tiline471-code/xzero-v1
- Repository: https://github.com/tiline471-code/xzero-v1

## Overview

XZERO is a Kryon language toolchain: users provide `.kry` source to FORGE, which tokenizes it, parses an AST, and generates `.kyb` bytecode; KVM can then execute bytecode files. The bytecode definitions cover functions, control flow, collections, and native calls, while the sampled runtime shows variable and collection operations and a `sys_exec` native. The repository also contains Kryon examples. Some runtime details and the exact handoff from generated output to KVM were not sampled, so that link is marked unverified.

Main entry points: [`FORGE/src/main.c`](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/main.c) (FORGE CLI), [`KVM/kvm.c`](https://github.com/tiline471-code/xzero-v1/blob/main/KVM/kvm.c) (Bytecode interpreter), [`FORGE/src/anvil.c`](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/anvil.c) (ANVIL codegen), [`COMMON/bytecode.h`](https://github.com/tiline471-code/xzero-v1/blob/main/COMMON/bytecode.h) (Bytecode contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_forge["FORGE compiler"]
  node_forge_cli["FORGE CLI<br/>[main.c]"]
  node_raster["RASTER lexer<br/>[raster.c]"]
  node_frame["FRAME parser<br/>[frame.c]"]
  node_anvil["ANVIL codegen<br/>[anvil.c]"]
end

subgraph group_bytecode["Bytecode format"]
  node_bytecode_contract["Bytecode contract<br/>[bytecode.h]"]
  node_bytecode_io["Bytecode I/O<br/>[bytecode.c]"]
  node_kyb_file["KYB file"]
end

subgraph group_kvm["KVM runtime"]
  node_kvm_cli["KVM CLI<br/>[main.c]"]
  node_interpreter["Bytecode interpreter<br/>[kvm.c]"]
  node_value_stack["Value stack<br/>[stack.c]"]
end

subgraph group_language["Kryon language"]
  node_examples["Kryon examples"]
end

node_developer(("Developer"))
node_sys_exec["System command"]

node_developer -->|"invokes"| node_forge_cli
node_forge_cli -->|"tokenizes"| node_raster
node_forge_cli -->|"parses tokens"| node_frame
node_forge_cli -->|"generates code"| node_anvil
node_anvil -->|"uses definitions"| node_bytecode_contract
node_kvm_cli -->|"runs file"| node_interpreter
node_interpreter -->|"interprets opcodes"| node_bytecode_contract
node_interpreter -->|"uses stack"| node_value_stack
node_interpreter -->|"executes command"| node_sys_exec
node_anvil -.->|"writes output"| node_kyb_file
node_kyb_file -.->|"input file"| node_kvm_cli
node_bytecode_io -->|"serializes structures"| node_bytecode_contract

click node_forge_cli "https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/main.c"
click node_raster "https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/raster.c"
click node_frame "https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/frame.c"
click node_anvil "https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/anvil.c"
click node_bytecode_contract "https://github.com/tiline471-code/xzero-v1/blob/main/COMMON/bytecode.h"
click node_bytecode_io "https://github.com/tiline471-code/xzero-v1/blob/main/COMMON/bytecode.c"
click node_kvm_cli "https://github.com/tiline471-code/xzero-v1/blob/main/KVM/main.c"
click node_interpreter "https://github.com/tiline471-code/xzero-v1/blob/main/KVM/kvm.c"
click node_value_stack "https://github.com/tiline471-code/xzero-v1/blob/main/KVM/stack.c"
click node_examples "https://github.com/tiline471-code/xzero-v1/tree/main/KRYON/examples"

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_forge_cli,node_raster,node_frame,node_anvil toneBlue
class node_bytecode_contract,node_bytecode_io,node_kyb_file toneAmber
class node_kvm_cli,node_interpreter,node_value_stack toneMint
class node_examples toneRose
class node_developer,node_sys_exec toneIndigo
```

## Components

### FORGE compiler

- [FORGE CLI](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/main.c): `FORGE/src/main.c`
- [RASTER lexer](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/raster.c): `FORGE/src/raster.c`
- [FRAME parser](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/frame.c): `FORGE/src/frame.c`
- [ANVIL codegen](https://github.com/tiline471-code/xzero-v1/blob/main/FORGE/src/anvil.c): `FORGE/src/anvil.c`

### Bytecode format

- [Bytecode contract](https://github.com/tiline471-code/xzero-v1/blob/main/COMMON/bytecode.h): `COMMON/bytecode.h`
- [Bytecode I/O](https://github.com/tiline471-code/xzero-v1/blob/main/COMMON/bytecode.c): `COMMON/bytecode.c`
- **KYB file**

### KVM runtime

- [KVM CLI](https://github.com/tiline471-code/xzero-v1/blob/main/KVM/main.c): `KVM/main.c`
- [Bytecode interpreter](https://github.com/tiline471-code/xzero-v1/blob/main/KVM/kvm.c): `KVM/kvm.c`
- [Value stack](https://github.com/tiline471-code/xzero-v1/blob/main/KVM/stack.c): `KVM/stack.c`

### Kryon language

- [Kryon examples](https://github.com/tiline471-code/xzero-v1/tree/main/KRYON/examples): `KRYON/examples`

### Other components

- **Developer**
- **System command**

## Connections

- Developer → FORGE CLI: invokes (evidence: `FORGE/src/main.c`)
- FORGE CLI → RASTER lexer: tokenizes (evidence: `FORGE/src/main.c`)
- FORGE CLI → FRAME parser: parses tokens (evidence: `FORGE/src/main.c`)
- FORGE CLI → ANVIL codegen: generates code (evidence: `FORGE/src/main.c`)
- ANVIL codegen → Bytecode contract: uses definitions
- KVM CLI → Bytecode interpreter: runs file (evidence: `KVM/main.c`)
- Bytecode interpreter → Bytecode contract: interprets opcodes (evidence: `KVM/kvm.c`)
- Bytecode interpreter → Value stack: uses stack (evidence: `KVM/kvm.c`)
- Bytecode interpreter → System command: executes command (evidence: `KVM/kvm.c`)
- ANVIL codegen → KYB file: writes output
- KYB file → KVM CLI: input file
- Bytecode I/O → Bytecode contract: serializes structures (evidence: `COMMON/bytecode.c`)
