# adhi7dawg/ngapak architecture

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

- Interactive diagram: https://gitdiagram.com/adhi7dawg/ngapak
- Repository: https://github.com/adhi7dawg/ngapak

## Overview

Ngapak is a small Python-based language translator and command-line runner for `.ngpk` programs. Its main workflow accepts a source file, translates Ngapak keywords into Python, then either writes the translation or executes it. The README also documents configuration and keyword management, optional standard-library keywords, and imports of other `.ngpk` modules. The source excerpt shows token translation and module loading, but omits much of CLI dispatch and execution; edges for documented workflows therefore cite the README, and unsampled internals are not inferred.

Main entry points: [`ngapak.py`](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py) (CLI commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli_entry["CLI commands<br/>[ngapak.py]"]
  node_config["Configuration<br/>[ngapak.py]"]
  node_config_commands["Config and keywords<br/>[ngapak.py]"]
end

subgraph group_language["Language processing"]
  node_keyword_map["Keyword mapping<br/>[ngapak.py]"]
  node_translator["Token translator<br/>[ngapak.py]"]
  node_file_translate["File translation<br/>[ngapak.py]"]
  node_module_loader["Module imports<br/>[ngapak.py]"]
end

subgraph group_runtime["Execution and support"]
  node_error_output["Error reporting<br/>[ngapak.py]"]
end

node_user(("Program author"))
node_program["Ngapak program"]
node_python_runtime["Python runtime"]

node_user -->|"runs command"| node_cli_entry
node_cli_entry -->|"accepts file"| node_program
node_cli_entry -->|"loads options"| node_config
node_config -->|"configures"| node_keyword_map
node_keyword_map -->|"supplies mappings"| node_translator
node_cli_entry -->|"translates file"| node_file_translate
node_file_translate -->|"translates tokens"| node_translator
node_file_translate -->|"writes Python"| node_python_runtime
node_cli_entry -->|"runs program"| node_python_runtime
node_module_loader -->|"translates imports"| node_translator
node_program -->|"imports modules"| node_module_loader
node_cli_entry -.->|"reports failures"| node_error_output
node_user -->|"requests settings"| node_config_commands
node_config_commands -.->|"reads configuration"| node_config

click node_cli_entry "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_config "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_keyword_map "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_translator "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_file_translate "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_module_loader "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_error_output "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"
click node_config_commands "https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py"

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_cli_entry,node_config,node_config_commands toneBlue
class node_keyword_map,node_translator,node_file_translate,node_module_loader toneAmber
class node_error_output toneMint
class node_user,node_program,node_python_runtime toneIndigo
```

## Components

### Command line

- [CLI commands](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`
- [Configuration](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`
- [Config and keywords](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`

### Language processing

- [Keyword mapping](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`
- [Token translator](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`
- [File translation](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`
- [Module imports](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`

### Execution and support

- [Error reporting](https://github.com/adhi7dawg/ngapak/blob/main/ngapak.py): `ngapak.py`

### Other components

- **Program author**
- **Ngapak program**
- **Python runtime**

## Connections

- Program author → CLI commands: runs command (evidence: `README.md`)
- CLI commands → Ngapak program: accepts file (evidence: `README.md`)
- CLI commands → Configuration: loads options (evidence: `README.md`)
- Configuration → Keyword mapping: configures (evidence: `ngapak.py`)
- Keyword mapping → Token translator: supplies mappings (evidence: `ngapak.py`)
- CLI commands → File translation: translates file (evidence: `README.md`)
- File translation → Token translator: translates tokens (evidence: `ngapak.py`)
- File translation → Python runtime: writes Python (evidence: `README.md`)
- CLI commands → Python runtime: runs program (evidence: `README.md`)
- Module imports → Token translator: translates imports (evidence: `ngapak.py`)
- Ngapak program → Module imports: imports modules (evidence: `README.md`)
- CLI commands → Error reporting: reports failures (evidence: `ngapak.py`)
- Program author → Config and keywords: requests settings (evidence: `README.md`)
- Config and keywords → Configuration: reads configuration (evidence: `ngapak.py`)
