# thury/nexocompiler architecture

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

- Interactive diagram: https://gitdiagram.com/thury/nexocompiler
- Repository: https://github.com/thury/nexocompiler

## Overview

nexocompiler is currently a command-line Ajolote lexical analyzer, not a full compiler pipeline. The user supplies a source file (or uses the default example); the CLI reads it, tokenizes its text with a table-driven finite-state automaton, and prints tokens or reports a lexical/file error. The README documents the token categories and matrix-driven recognition. Some helper implementations were omitted from the excerpts, so their internal wiring is not expanded beyond calls visible in the sampled code.

Main entry points: [`analizador_lexico.py`](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py) (CLI entry), [`ejemplo.nexo`](https://github.com/thury/nexocompiler/blob/main/ejemplo.nexo) (Ajolote source)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_source["Ajolote source<br/>[ejemplo.nexo]"]
node_cli["CLI entry"]
node_reader["File reader"]
node_tokenizer["Tokenizer"]
node_classifier["Character classifier"]
node_automaton["DFA matrix and delta"]
node_token_types["Token type mapping"]
node_tokens["Token stream"]
node_stdout["Token output"]
node_stderr["Error output"]

node_user -->|"runs with file"| node_cli
node_source -->|"read text"| node_reader
node_cli -->|"reads file"| node_reader
node_reader -->|"returns text"| node_cli
node_cli -->|"tokenizes text"| node_tokenizer
node_tokenizer -->|"classifies characters"| node_classifier
node_tokenizer -->|"gets transitions"| node_automaton
node_tokenizer -->|"maps acceptors"| node_token_types
node_tokenizer -->|"produces tokens"| node_tokens
node_cli -->|"prints tokens"| node_stdout
node_cli -->|"reports errors"| node_stderr

click node_source "https://github.com/thury/nexocompiler/blob/main/ejemplo.nexo"
click node_cli "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py"
click node_reader "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py"
click node_tokenizer "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py"
click node_classifier "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py"
click node_automaton "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py"
click node_token_types "https://github.com/thury/nexocompiler/blob/main/analizador_lexico.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_user toneBlue
class node_source,node_cli,node_reader,node_tokenizer,node_classifier,node_automaton,node_token_types toneTeal
class node_tokens,node_stdout,node_stderr toneIndigo
```

## Components

### Other components

- **User**
- [Ajolote source](https://github.com/thury/nexocompiler/blob/main/ejemplo.nexo): `ejemplo.nexo`
- [CLI entry](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [File reader](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [Tokenizer](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [Character classifier](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [DFA matrix and delta](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [Token type mapping](https://github.com/thury/nexocompiler/blob/main/analizador_lexico.py): `analizador_lexico.py`
- **Token stream**
- **Token output**
- **Error output**

## Connections

- User → CLI entry: runs with file
- Ajolote source → File reader: read text
- CLI entry → File reader: reads file
- File reader → CLI entry: returns text
- CLI entry → Tokenizer: tokenizes text
- Tokenizer → Character classifier: classifies characters
- Tokenizer → DFA matrix and delta: gets transitions
- Tokenizer → Token type mapping: maps acceptors
- Tokenizer → Token stream: produces tokens
- CLI entry → Token output: prints tokens
- CLI entry → Error output: reports errors
