# dot-underscore1703/dustbunny architecture

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

- Interactive diagram: https://gitdiagram.com/dot-underscore1703/dustbunny
- Repository: https://github.com/dot-underscore1703/dustbunny

## Overview

Dustbunny is a hobby Unix shell. Its demonstrated workflow accepts interactive or `-c` input, tokenizes it, and can print the tokens with `-t`; the sampled entry point does not parse or execute commands. The repository also contains builtin-command implementations and token-preprocessing and syntax-tree support, but their runtime wiring is not shown. The graph links only relationships supported by the excerpts or SOURCE INDEX; those unsupported components are shown without guessed call paths.

Main entry points: [`src/main.c`](https://github.com/dot-underscore1703/dustbunny/blob/master/src/main.c) (Input and Token Display), [`src/debug.c`](https://github.com/dot-underscore1703/dustbunny/blob/master/src/debug.c) (Debug Output), [`src/lexer.c`](https://github.com/dot-underscore1703/dustbunny/blob/master/src/lexer.c) (Input Lexer), [`src/tokens.c`](https://github.com/dot-underscore1703/dustbunny/blob/master/src/tokens.c) (Token Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Shell Entry"]
  node_main["Input and Token Display<br/>[main.c]"]
end

subgraph group_lexing["Tokenization"]
  node_lexer["Input Lexer<br/>[lexer.c]"]
  node_tokens["Token Management<br/>[tokens.c]"]
  node_preproc["Token Preprocessing<br/>[preproc.c]"]
  node_nodes["Syntax Tree Nodes<br/>[nodes.c]"]
end

subgraph group_runtime["Shell Support"]
  node_builtins["Builtin Commands<br/>[builtins.c]"]
  node_debug["Debug Output<br/>[debug.c]"]
end

node_user(("User"))
node_terminal["Terminal Output"]

node_user -->|"provides input"| node_main
node_main -->|"tokenizes input"| node_lexer
node_lexer -->|"creates tokens"| node_tokens
node_main -->|"prints tokens"| node_terminal
node_main -->|"logs input"| node_debug
node_lexer -->|"logs lexing"| node_debug
node_tokens -->|"logs token operations"| node_debug
node_nodes -->|"logs node operations"| node_debug

click node_main "https://github.com/dot-underscore1703/dustbunny/blob/master/src/main.c"
click node_lexer "https://github.com/dot-underscore1703/dustbunny/blob/master/src/lexer.c"
click node_tokens "https://github.com/dot-underscore1703/dustbunny/blob/master/src/tokens.c"
click node_preproc "https://github.com/dot-underscore1703/dustbunny/blob/master/src/preproc.c"
click node_nodes "https://github.com/dot-underscore1703/dustbunny/blob/master/src/nodes.c"
click node_builtins "https://github.com/dot-underscore1703/dustbunny/blob/master/src/builtins.c"
click node_debug "https://github.com/dot-underscore1703/dustbunny/blob/master/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_main,node_user toneBlue
class node_lexer,node_tokens,node_preproc,node_nodes toneAmber
class node_builtins,node_debug toneMint
class node_terminal toneIndigo
```

## Components

### Shell Entry

- [Input and Token Display](https://github.com/dot-underscore1703/dustbunny/blob/master/src/main.c): `src/main.c`

### Tokenization

- [Input Lexer](https://github.com/dot-underscore1703/dustbunny/blob/master/src/lexer.c): `src/lexer.c`
- [Token Management](https://github.com/dot-underscore1703/dustbunny/blob/master/src/tokens.c): `src/tokens.c`
- [Token Preprocessing](https://github.com/dot-underscore1703/dustbunny/blob/master/src/preproc.c): `src/preproc.c`
- [Syntax Tree Nodes](https://github.com/dot-underscore1703/dustbunny/blob/master/src/nodes.c): `src/nodes.c`

### Shell Support

- [Builtin Commands](https://github.com/dot-underscore1703/dustbunny/blob/master/src/builtins.c): `src/builtins.c`
- [Debug Output](https://github.com/dot-underscore1703/dustbunny/blob/master/src/debug.c): `src/debug.c`

### Other components

- **User**
- **Terminal Output**

## Connections

- User → Input and Token Display: provides input (evidence: `src/main.c`)
- Input and Token Display → Input Lexer: tokenizes input (evidence: `src/main.c`)
- Input Lexer → Token Management: creates tokens (evidence: `src/lexer.c`)
- Input and Token Display → Terminal Output: prints tokens (evidence: `src/main.c`)
- Input and Token Display → Debug Output: logs input (evidence: `src/main.c`)
- Input Lexer → Debug Output: logs lexing (evidence: `src/lexer.c`)
- Token Management → Debug Output: logs token operations (evidence: `src/tokens.c`)
- Syntax Tree Nodes → Debug Output: logs node operations (evidence: `src/nodes.c`)
