# hatsunemikutoro-hash/axyslang architecture

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

- Interactive diagram: https://gitdiagram.com/hatsunemikutoro-hash/axyslang
- Repository: https://github.com/hatsunemikutoro-hash/axyslang

## Overview

Axys is a small instruction- and memory-based language interpreter. A user supplies an `.axs` file; the command-line program creates an interpreter, which loads and parses the source into a program before the VM executes its instructions against a 256-cell memory. The graph preserves the documented language workflow and the separate lexer, parser, program, and VM layers. The interpreter implementation is indexed as read but not excerpted, so its internal orchestration links are shown as unverified.

Main entry points: [`src/parser.c`](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/parser.c) (Parser), [`src/interpreter.c`](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/interpreter.c) (Interpreter), [`src/vm.c`](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/vm.c) (VM executor), [`src/main.c`](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/main.c) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Source frontend"]
  node_file_loader["Source loader<br/>[openfile.c]"]
  node_lexer["Lexer<br/>[tokenizer.c]"]
  node_parser["Parser<br/>[parser.c]"]
  node_ast["Instruction AST<br/>[ast.h]"]
  node_program["Parsed program<br/>[program.c]"]
end

subgraph group_runtime["Execution runtime"]
  node_interpreter["Interpreter<br/>[interpreter.c]"]
  node_vm["VM executor<br/>[vm.c]"]
  node_machine[("Machine state<br/>[vm.h]")]
end

subgraph group_support["CLI and diagnostics"]
  node_cli["CLI entry<br/>[main.c]"]
  node_debug["Debug tools<br/>[debug.c]"]
end

node_user(("Language user"))

node_user -->|"runs file"| node_cli
node_cli -->|"creates and runs"| node_interpreter
node_cli -->|"parses options"| node_debug
node_interpreter -.->|"loads source"| node_file_loader
node_interpreter -.->|"starts parsing"| node_parser
node_interpreter -.->|"runs program"| node_vm
node_parser -->|"gets tokens"| node_lexer
node_parser -->|"builds nodes"| node_ast
node_parser -->|"adds instructions"| node_program
node_vm -->|"updates state"| node_machine
node_vm -->|"prints diagnostics"| node_debug

click node_cli "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/main.c"
click node_interpreter "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/interpreter.c"
click node_file_loader "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/openfile.c"
click node_lexer "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/tokenizer.c"
click node_parser "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/parser.c"
click node_ast "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/include/ast.h"
click node_program "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/program.c"
click node_vm "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/vm.c"
click node_machine "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/include/vm.h"
click node_debug "https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/debug.c"

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_file_loader,node_lexer,node_parser,node_ast,node_program,node_user toneBlue
class node_interpreter,node_vm,node_machine toneAmber
class node_cli,node_debug toneMint
```

## Components

### Source frontend

- [Source loader](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/openfile.c): `src/openfile.c`
- [Lexer](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/tokenizer.c): `src/tokenizer.c`
- [Parser](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/parser.c): `src/parser.c`
- [Instruction AST](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/include/ast.h): `include/ast.h`
- [Parsed program](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/program.c): `src/program.c`

### Execution runtime

- [Interpreter](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/interpreter.c): `src/interpreter.c`
- [VM executor](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/vm.c): `src/vm.c`
- [Machine state](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/include/vm.h): `include/vm.h`

### CLI and diagnostics

- [CLI entry](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/main.c): `src/main.c`
- [Debug tools](https://github.com/hatsunemikutoro-hash/axyslang/blob/main/src/debug.c): `src/debug.c`

### Other components

- **Language user**

## Connections

- Language user → CLI entry: runs file (evidence: `README.md`)
- CLI entry → Interpreter: creates and runs (evidence: `src/main.c`)
- CLI entry → Debug tools: parses options (evidence: `src/main.c`)
- Interpreter → Source loader: loads source
- Interpreter → Parser: starts parsing
- Interpreter → VM executor: runs program
- Parser → Lexer: gets tokens (evidence: `src/parser.c`)
- Parser → Instruction AST: builds nodes (evidence: `src/parser.c`)
- Parser → Parsed program: adds instructions (evidence: `src/parser.c`)
- VM executor → Machine state: updates state (evidence: `src/vm.c`)
- VM executor → Debug tools: prints diagnostics (evidence: `src/vm.c`)
