# nathantodd-devel/minlang architecture

> Architecture diagram of the GitHub repository nathantodd-devel/minlang, 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/nathantodd-devel/minlang
- Repository: https://github.com/nathantodd-devel/minlang

## Overview

minlang is an early-stage language tokenizer with a CLI that reads a source file, tokenizes it, validates the token stream, and prints JSON or formatted errors. Token definitions and schemas support tokenization and a parser scaffold; the CLI does not invoke that parser. The README gives no further product capabilities. The parser’s parse method is empty, and the available excerpts do not establish a larger compilation workflow.

Main entry points: [`src/index.ts`](https://github.com/nathantodd-devel/minlang/blob/main/src/index.ts) (CLI entry), [`src/tokenizer/index.ts`](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/index.ts) (Tokenizer), [`src/tokenizer/tokens.ts`](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/tokens.ts) (Token schemas), [`src/tokenizer/errors.ts`](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/errors.ts) (Lexical errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_main["CLI entry<br/>[index.ts]"]
end

subgraph group_lexing["Tokenization"]
  node_tokenizer["Tokenizer<br/>[index.ts]"]
  node_token_errors["Lexical errors<br/>[errors.ts]"]
  node_utils["String utility<br/>[utils.ts]"]
end

subgraph group_language["Language model"]
  node_tokens["Token schemas<br/>[tokens.ts]"]
  node_generic_error["Generic error<br/>[index.ts]"]
  node_parser["Parser scaffold<br/>[index.ts]"]
  node_expressions["Expression schema<br/>[expression.ts]"]
end

node_user(("CLI user"))
node_source["Source file"]
node_json["Token JSON"]

node_user -->|"invokes"| node_main
node_main -->|"reads"| node_source
node_main -->|"tokenizes with"| node_tokenizer
node_tokenizer -->|"uses schemas"| node_tokens
node_tokenizer -->|"raises"| node_token_errors
node_tokenizer -->|"uses"| node_utils
node_token_errors -->|"extends"| node_generic_error
node_main -->|"validates stream"| node_tokens
node_main -->|"prints tokens"| node_json
node_main -->|"formats errors"| node_token_errors
node_parser -->|"validates stream"| node_tokens
node_expressions -->|"uses token schema"| node_tokens

click node_main "https://github.com/nathantodd-devel/minlang/blob/main/src/index.ts"
click node_tokenizer "https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/index.ts"
click node_token_errors "https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/errors.ts"
click node_tokens "https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/tokens.ts"
click node_utils "https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/utils.ts"
click node_generic_error "https://github.com/nathantodd-devel/minlang/blob/main/src/error/index.ts"
click node_parser "https://github.com/nathantodd-devel/minlang/blob/main/src/parser/index.ts"
click node_expressions "https://github.com/nathantodd-devel/minlang/blob/main/src/parser/expression.ts"

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_tokenizer,node_token_errors,node_utils toneAmber
class node_tokens,node_generic_error,node_parser,node_expressions toneMint
class node_source,node_json toneIndigo
```

## Components

### CLI

- [CLI entry](https://github.com/nathantodd-devel/minlang/blob/main/src/index.ts): `src/index.ts`

### Tokenization

- [Tokenizer](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/index.ts): `src/tokenizer/index.ts`
- [Lexical errors](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/errors.ts): `src/tokenizer/errors.ts`
- [String utility](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/utils.ts): `src/tokenizer/utils.ts`

### Language model

- [Token schemas](https://github.com/nathantodd-devel/minlang/blob/main/src/tokenizer/tokens.ts): `src/tokenizer/tokens.ts`
- [Generic error](https://github.com/nathantodd-devel/minlang/blob/main/src/error/index.ts): `src/error/index.ts`
- [Parser scaffold](https://github.com/nathantodd-devel/minlang/blob/main/src/parser/index.ts): `src/parser/index.ts`
- [Expression schema](https://github.com/nathantodd-devel/minlang/blob/main/src/parser/expression.ts): `src/parser/expression.ts`

### Other components

- **CLI user**
- **Source file**
- **Token JSON**

## Connections

- CLI user → CLI entry: invokes (evidence: `src/index.ts`)
- CLI entry → Source file: reads (evidence: `src/index.ts`)
- CLI entry → Tokenizer: tokenizes with (evidence: `src/index.ts`)
- Tokenizer → Token schemas: uses schemas (evidence: `src/tokenizer/index.ts`)
- Tokenizer → Lexical errors: raises (evidence: `src/tokenizer/index.ts`)
- Tokenizer → String utility: uses (evidence: `src/tokenizer/index.ts`)
- Lexical errors → Generic error: extends (evidence: `src/tokenizer/errors.ts`)
- CLI entry → Token schemas: validates stream (evidence: `src/index.ts`)
- CLI entry → Token JSON: prints tokens (evidence: `src/index.ts`)
- CLI entry → Lexical errors: formats errors (evidence: `src/index.ts`)
- Parser scaffold → Token schemas: validates stream (evidence: `src/parser/index.ts`)
- Expression schema → Token schemas: uses token schema (evidence: `src/parser/expression.ts`)
