# akene-uzezi/bwh-rust architecture

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

- Interactive diagram: https://gitdiagram.com/akene-uzezi/bwh-rust
- Repository: https://github.com/akene-uzezi/bwh-rust

## Overview

This learning project provides a command-line tokenizing REPL and a library lexer/parser that builds a partial AST. The CLI path is user → binary → REPL → lexer; the parser is a separate library capability that consumes a lexer and constructs AST statements. Parsing currently supports let and return statements, not full expression evaluation. The graph reflects the shown calls and documented usage; it does not imply that the REPL invokes the parser.

Main entry points: [`src/repl.rs`](https://github.com/akene-uzezi/bwh-rust/blob/main/src/repl.rs) (Tokenizing REPL), [`src/lexer.rs`](https://github.com/akene-uzezi/bwh-rust/blob/main/src/lexer.rs) (Lexer), [`src/parser.rs`](https://github.com/akene-uzezi/bwh-rust/blob/main/src/parser.rs) (Statement Parser), [`src/main.rs`](https://github.com/akene-uzezi/bwh-rust/blob/main/src/main.rs) (CLI Binary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Interactive CLI"]
  node_binary["CLI Binary<br/>[main.rs]"]
  node_repl["Tokenizing REPL<br/>[repl.rs]"]
end

subgraph group_frontend["Language Front End"]
  node_lexer["Lexer<br/>[lexer.rs]"]
  node_tokens["Token Types<br/>[token.rs]"]
  node_parser["Statement Parser<br/>[parser.rs]"]
end

subgraph group_syntax["Syntax Model"]
  node_ast["AST Nodes<br/>[ast.rs]"]
end

node_user(("Language User"))

node_user -->|"launches"| node_binary
node_binary -->|"starts"| node_repl
node_user -->|"enters lines"| node_repl
node_repl -->|"tokenizes lines"| node_lexer
node_lexer -->|"creates tokens"| node_tokens
node_parser -->|"consumes tokens"| node_lexer
node_parser -->|"builds statements"| node_ast
node_ast -->|"stores tokens"| node_tokens

click node_binary "https://github.com/akene-uzezi/bwh-rust/blob/main/src/main.rs"
click node_repl "https://github.com/akene-uzezi/bwh-rust/blob/main/src/repl.rs"
click node_lexer "https://github.com/akene-uzezi/bwh-rust/blob/main/src/lexer.rs"
click node_tokens "https://github.com/akene-uzezi/bwh-rust/blob/main/src/token.rs"
click node_parser "https://github.com/akene-uzezi/bwh-rust/blob/main/src/parser.rs"
click node_ast "https://github.com/akene-uzezi/bwh-rust/blob/main/src/ast.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_binary,node_repl,node_user toneBlue
class node_lexer,node_tokens,node_parser toneAmber
class node_ast toneMint
```

## Components

### Interactive CLI

- [CLI Binary](https://github.com/akene-uzezi/bwh-rust/blob/main/src/main.rs): `src/main.rs`
- [Tokenizing REPL](https://github.com/akene-uzezi/bwh-rust/blob/main/src/repl.rs): `src/repl.rs`

### Language Front End

- [Lexer](https://github.com/akene-uzezi/bwh-rust/blob/main/src/lexer.rs): `src/lexer.rs`
- [Token Types](https://github.com/akene-uzezi/bwh-rust/blob/main/src/token.rs): `src/token.rs`
- [Statement Parser](https://github.com/akene-uzezi/bwh-rust/blob/main/src/parser.rs): `src/parser.rs`

### Syntax Model

- [AST Nodes](https://github.com/akene-uzezi/bwh-rust/blob/main/src/ast.rs): `src/ast.rs`

### Other components

- **Language User**

## Connections

- Language User → CLI Binary: launches (evidence: `README.md`)
- CLI Binary → Tokenizing REPL: starts (evidence: `src/main.rs`)
- Language User → Tokenizing REPL: enters lines (evidence: `README.md`)
- Tokenizing REPL → Lexer: tokenizes lines (evidence: `src/repl.rs`)
- Lexer → Token Types: creates tokens (evidence: `src/lexer.rs`)
- Statement Parser → Lexer: consumes tokens (evidence: `src/parser.rs`)
- Statement Parser → AST Nodes: builds statements (evidence: `src/parser.rs`)
- AST Nodes → Token Types: stores tokens (evidence: `src/ast.rs`)
