# michhsolis/compilador architecture

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

- Interactive diagram: https://gitdiagram.com/michhsolis/compilador
- Repository: https://github.com/michhsolis/compilador

## Overview

This repository is a small compiler workbench for a C-like language. A user enters or opens source in the Tkinter interface; the interface runs lexical analysis, then parsing, semantic validation, and intermediate-code generation, displaying tokens, diagnostics, the decorated AST, symbols, and TAC. The lexer, parser, semantic analyzer, and TAC generator are distinct compiler stages; symbol-table management is an internal semantic layer. Edges follow shown calls or explicit module documentation; the TAC-generation call is not visible in the excerpts, so that link is marked unverified.

Main entry points: [`Interfaz.py`](https://github.com/michhsolis/compilador/blob/main/Interfaz.py) (Tkinter workbench), [`analizador_lexico.py`](https://github.com/michhsolis/compilador/blob/main/analizador_lexico.py) (Lexical analyzer), [`analizador_semantico.py`](https://github.com/michhsolis/compilador/blob/main/analizador_semantico.py) (Semantic analyzer), [`analizador_sintactico.py`](https://github.com/michhsolis/compilador/blob/main/analizador_sintactico.py) (Parser and AST)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gui["Tkinter workbench<br/>[Interfaz.py]"]
end

subgraph group_frontend["Compiler front end"]
  node_lexer["Lexical analyzer"]
  node_parser["Parser and AST"]
end

subgraph group_semantic["Semantic analysis"]
  node_semantics["Semantic analyzer"]
  node_symbols["Scopes and symbols"]
end

subgraph group_intermediate["Intermediate code"]
  node_tac["TAC generator"]
end

node_user(("Source author"))

node_user -->|"enters source"| node_gui
node_gui -->|"analyzes text"| node_lexer
node_lexer -->|"supplies tokens"| node_parser
node_gui -->|"parses tokens"| node_parser
node_gui -->|"validates AST"| node_semantics
node_semantics -.->|"records scopes"| node_symbols
node_gui -.->|"generates TAC"| node_tac

click node_gui "https://github.com/michhsolis/compilador/blob/main/Interfaz.py"
click node_lexer "https://github.com/michhsolis/compilador/blob/main/analizador_lexico.py"
click node_parser "https://github.com/michhsolis/compilador/blob/main/analizador_sintactico.py"
click node_semantics "https://github.com/michhsolis/compilador/blob/main/analizador_semantico.py"
click node_symbols "https://github.com/michhsolis/compilador/blob/main/analizador_semantico.py"
click node_tac "https://github.com/michhsolis/compilador/blob/main/generador_intermedio.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_gui toneBlue
class node_lexer,node_parser toneAmber
class node_semantics,node_symbols toneMint
class node_tac toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Tkinter workbench](https://github.com/michhsolis/compilador/blob/main/Interfaz.py): `Interfaz.py`

### Compiler front end

- [Lexical analyzer](https://github.com/michhsolis/compilador/blob/main/analizador_lexico.py): `analizador_lexico.py`
- [Parser and AST](https://github.com/michhsolis/compilador/blob/main/analizador_sintactico.py): `analizador_sintactico.py`

### Semantic analysis

- [Semantic analyzer](https://github.com/michhsolis/compilador/blob/main/analizador_semantico.py): `analizador_semantico.py`
- [Scopes and symbols](https://github.com/michhsolis/compilador/blob/main/analizador_semantico.py): `analizador_semantico.py`

### Intermediate code

- [TAC generator](https://github.com/michhsolis/compilador/blob/main/generador_intermedio.py): `generador_intermedio.py`

### Other components

- **Source author**

## Connections

- Source author → Tkinter workbench: enters source (evidence: `Interfaz.py`)
- Tkinter workbench → Lexical analyzer: analyzes text (evidence: `Interfaz.py`)
- Lexical analyzer → Parser and AST: supplies tokens (evidence: `analizador_sintactico.py`)
- Tkinter workbench → Parser and AST: parses tokens (evidence: `Interfaz.py`)
- Tkinter workbench → Semantic analyzer: validates AST (evidence: `Interfaz.py`)
- Semantic analyzer → Scopes and symbols: records scopes (evidence: `analizador_semantico.py`)
- Tkinter workbench → TAC generator: generates TAC (evidence: `Interfaz.py`)
