# uncodem/exbas architecture

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

- Interactive diagram: https://gitdiagram.com/uncodem/exbas
- Repository: https://github.com/uncodem/exbas

## Overview

ExBas is a BASIC-inspired, expression-oriented interpreter implemented in OCaml and Zig. The tree identifies compiler and VM modules, but no source excerpts are available and the README does not document their runtime handoffs. The graph therefore shows the identifiable product components without inferring a user-to-result pipeline or unsupported calls between them.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_compiler["OCaml compiler"]
  node_lexer["Lexer<br/>[lexer.ml]"]
  node_parser["Parser<br/>[parser.ml]"]
  node_checker["Checker<br/>[checker.ml]"]
  node_emitter["Emitter<br/>[emitter.ml]"]
  node_bingen["Binary generation<br/>[bingen.ml]"]
  node_compiler_opcodes["Compiler opcodes<br/>[opcodes.ml]"]
  node_compiler_entry["Compiler entry<br/>[main.ml]"]
end

subgraph group_vm["Zig virtual machine"]
  node_vm_entry["VM entry<br/>[main.zig]"]
  node_loader["Program loader<br/>[loader.zig]"]
  node_core["Execution core<br/>[core.zig]"]
  node_vm_interface["VM interface<br/>[interface.zig]"]
  node_stack["Value stack<br/>[stack.zig]"]
  node_values["Runtime values<br/>[vals.zig]"]
  node_vm_opcodes["VM opcodes<br/>[opcodes.zig]"]
  node_debug["Runtime debugging<br/>[debug.zig]"]
end

node_user(("Program author"))

click node_lexer "https://github.com/uncodem/exbas/blob/master/src/compiler/lexer.ml"
click node_parser "https://github.com/uncodem/exbas/blob/master/src/compiler/parser.ml"
click node_checker "https://github.com/uncodem/exbas/blob/master/src/compiler/checker.ml"
click node_emitter "https://github.com/uncodem/exbas/blob/master/src/compiler/emitter.ml"
click node_bingen "https://github.com/uncodem/exbas/blob/master/src/compiler/bingen.ml"
click node_compiler_opcodes "https://github.com/uncodem/exbas/blob/master/src/compiler/opcodes.ml"
click node_compiler_entry "https://github.com/uncodem/exbas/blob/master/src/compiler/main.ml"
click node_vm_entry "https://github.com/uncodem/exbas/blob/master/src/vm/main.zig"
click node_loader "https://github.com/uncodem/exbas/blob/master/src/vm/loader.zig"
click node_core "https://github.com/uncodem/exbas/blob/master/src/vm/core.zig"
click node_vm_interface "https://github.com/uncodem/exbas/blob/master/src/vm/interface.zig"
click node_stack "https://github.com/uncodem/exbas/blob/master/src/vm/stack.zig"
click node_values "https://github.com/uncodem/exbas/blob/master/src/vm/vals.zig"
click node_vm_opcodes "https://github.com/uncodem/exbas/blob/master/src/vm/opcodes.zig"
click node_debug "https://github.com/uncodem/exbas/blob/master/src/vm/debug.zig"

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_checker,node_emitter,node_bingen,node_compiler_opcodes,node_compiler_entry toneBlue
class node_vm_entry,node_loader,node_core,node_vm_interface,node_stack,node_values,node_vm_opcodes,node_debug toneAmber
class node_user toneIndigo
```

## Components

### OCaml compiler

- [Lexer](https://github.com/uncodem/exbas/blob/master/src/compiler/lexer.ml): `src/compiler/lexer.ml`
- [Parser](https://github.com/uncodem/exbas/blob/master/src/compiler/parser.ml): `src/compiler/parser.ml`
- [Checker](https://github.com/uncodem/exbas/blob/master/src/compiler/checker.ml): `src/compiler/checker.ml`
- [Emitter](https://github.com/uncodem/exbas/blob/master/src/compiler/emitter.ml): `src/compiler/emitter.ml`
- [Binary generation](https://github.com/uncodem/exbas/blob/master/src/compiler/bingen.ml): `src/compiler/bingen.ml`
- [Compiler opcodes](https://github.com/uncodem/exbas/blob/master/src/compiler/opcodes.ml): `src/compiler/opcodes.ml`
- [Compiler entry](https://github.com/uncodem/exbas/blob/master/src/compiler/main.ml): `src/compiler/main.ml`

### Zig virtual machine

- [VM entry](https://github.com/uncodem/exbas/blob/master/src/vm/main.zig): `src/vm/main.zig`
- [Program loader](https://github.com/uncodem/exbas/blob/master/src/vm/loader.zig): `src/vm/loader.zig`
- [Execution core](https://github.com/uncodem/exbas/blob/master/src/vm/core.zig): `src/vm/core.zig`
- [VM interface](https://github.com/uncodem/exbas/blob/master/src/vm/interface.zig): `src/vm/interface.zig`
- [Value stack](https://github.com/uncodem/exbas/blob/master/src/vm/stack.zig): `src/vm/stack.zig`
- [Runtime values](https://github.com/uncodem/exbas/blob/master/src/vm/vals.zig): `src/vm/vals.zig`
- [VM opcodes](https://github.com/uncodem/exbas/blob/master/src/vm/opcodes.zig): `src/vm/opcodes.zig`
- [Runtime debugging](https://github.com/uncodem/exbas/blob/master/src/vm/debug.zig): `src/vm/debug.zig`

### Other components

- **Program author**
