# nixhantb/hashlang architecture

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

- Interactive diagram: https://gitdiagram.com/nixhantb/hashlang
- Repository: https://github.com/nixhantb/hashlang

## Overview

HashLang is a small command-line interpreter. A user enters a command in the interactive loop; the loop tokenizes it, parses the tokens, and dispatches the parsed command to the evaluator. The evaluator handles printing and assignments, evaluates integer expressions, and reads or updates its variable dictionary. The README also describes exit handling, which the loop implements directly. The parser produces a command-and-arguments tuple rather than the AST described in the README; the graph follows the sampled implementation.

Main entry points: [`Program.cs`](https://github.com/nixhantb/hashlang/blob/main/Program.cs) (Interactive Loop), [`src/Core/Evaluater.cs`](https://github.com/nixhantb/hashlang/blob/main/src/Core/Evaluater.cs) (Command Evaluator), [`src/Lexer/Lexer.cs`](https://github.com/nixhantb/hashlang/blob/main/src/Lexer/Lexer.cs) (Tokenizer), [`src/Parser/Parser.cs`](https://github.com/nixhantb/hashlang/blob/main/src/Parser/Parser.cs) (Command Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command Interface"]
  node_repl["Interactive Loop<br/>[Program.cs]"]
end

subgraph group_frontend["Language Front End"]
  node_lexer["Tokenizer<br/>[Lexer.cs]"]
  node_parser["Command Parser<br/>[Parser.cs]"]
end

subgraph group_runtime["Execution Runtime"]
  node_evaluator["Command Evaluator<br/>[Evaluater.cs]"]
  node_variables[("Variable Store<br/>[Evaluater.cs]")]
end

node_user(("User"))

node_user -->|"enters commands"| node_repl
node_repl -->|"prompts and reports"| node_user
node_repl -->|"tokenizes input"| node_lexer
node_repl -->|"parses tokens"| node_parser
node_repl -->|"evaluates parsed command"| node_evaluator
node_evaluator -->|"reads and writes"| node_variables
node_evaluator -->|"prints results"| node_user

click node_repl "https://github.com/nixhantb/hashlang/blob/main/Program.cs"
click node_lexer "https://github.com/nixhantb/hashlang/blob/main/src/Lexer/Lexer.cs"
click node_parser "https://github.com/nixhantb/hashlang/blob/main/src/Parser/Parser.cs"
click node_evaluator "https://github.com/nixhantb/hashlang/blob/main/src/Core/Evaluater.cs"
click node_variables "https://github.com/nixhantb/hashlang/blob/main/src/Core/Evaluater.cs"

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_repl,node_user toneBlue
class node_lexer,node_parser toneAmber
class node_evaluator,node_variables toneMint
```

## Components

### Command Interface

- [Interactive Loop](https://github.com/nixhantb/hashlang/blob/main/Program.cs): `Program.cs`

### Language Front End

- [Tokenizer](https://github.com/nixhantb/hashlang/blob/main/src/Lexer/Lexer.cs): `src/Lexer/Lexer.cs`
- [Command Parser](https://github.com/nixhantb/hashlang/blob/main/src/Parser/Parser.cs): `src/Parser/Parser.cs`

### Execution Runtime

- [Command Evaluator](https://github.com/nixhantb/hashlang/blob/main/src/Core/Evaluater.cs): `src/Core/Evaluater.cs`
- [Variable Store](https://github.com/nixhantb/hashlang/blob/main/src/Core/Evaluater.cs): `src/Core/Evaluater.cs`

### Other components

- **User**

## Connections

- User → Interactive Loop: enters commands (evidence: `README.md`)
- Interactive Loop → User: prompts and reports (evidence: `Program.cs`)
- Interactive Loop → Tokenizer: tokenizes input (evidence: `Program.cs`)
- Interactive Loop → Command Parser: parses tokens (evidence: `Program.cs`)
- Interactive Loop → Command Evaluator: evaluates parsed command (evidence: `Program.cs`)
- Command Evaluator → Variable Store: reads and writes (evidence: `src/Core/Evaluater.cs`)
- Command Evaluator → User: prints results (evidence: `src/Core/Evaluater.cs`)
