# devrodofc/analisador-lexico architecture

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

- Interactive diagram: https://gitdiagram.com/devrodofc/analisador-lexico
- Repository: https://github.com/devrodofc/analisador-lexico

## Overview

This is a small educational Java compiler front end. Its documented workflow reads input.txt, creates a generated JFlex scanner, and starts the generated CUP parser, which pulls tokens and performs parsing with simple semantic actions for declarations, assignments, conditionals, loops, and arithmetic expressions. The graph focuses on runtime behavior; generator specifications are omitted. Relationships are limited to the excerpts and README, so grammar details beyond the shown parser actions are not expanded.

Main entry points: [`src/Main.java`](https://github.com/devrodofc/analisador-lexico/blob/main/src/Main.java) (Compiler entry), [`gen/parser/parser.java`](https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/parser.java) (Syntax and actions), [`gen/lexer/Lexer.java`](https://github.com/devrodofc/analisador-lexico/blob/main/gen/lexer/Lexer.java) (Lexical scanner), [`gen/parser/sym.java`](https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/sym.java) (Token symbols)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime entry"]
  node_main["Compiler entry<br/>[Main.java]"]
  node_input["Source input<br/>[input.txt]"]
end

subgraph group_analysis["Front-end analysis"]
  node_lexer["Lexical scanner<br/>[Lexer.java]"]
  node_parser["Syntax and actions<br/>[parser.java]"]
end

subgraph group_tokens["Token contract"]
  node_symbols["Token symbols<br/>[sym.java]"]
end

node_user(("User"))
node_console(("Console output"))

node_user -->|"runs"| node_main
node_main -->|"reads"| node_input
node_main -->|"creates"| node_lexer
node_main -->|"starts"| node_parser
node_parser -->|"pulls tokens"| node_lexer
node_lexer -->|"uses tokens"| node_symbols
node_parser -->|"defines symbols"| node_symbols
node_parser -->|"prints actions"| node_console
node_main -->|"prints status"| node_console

click node_main "https://github.com/devrodofc/analisador-lexico/blob/main/src/Main.java"
click node_input "https://github.com/devrodofc/analisador-lexico/blob/main/input.txt"
click node_lexer "https://github.com/devrodofc/analisador-lexico/blob/main/gen/lexer/Lexer.java"
click node_parser "https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/parser.java"
click node_symbols "https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/sym.java"

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_input,node_user toneBlue
class node_lexer,node_parser toneAmber
class node_symbols toneMint
class node_console toneIndigo
```

## Components

### Runtime entry

- [Compiler entry](https://github.com/devrodofc/analisador-lexico/blob/main/src/Main.java): `src/Main.java`
- [Source input](https://github.com/devrodofc/analisador-lexico/blob/main/input.txt): `input.txt`

### Front-end analysis

- [Lexical scanner](https://github.com/devrodofc/analisador-lexico/blob/main/gen/lexer/Lexer.java): `gen/lexer/Lexer.java`
- [Syntax and actions](https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/parser.java): `gen/parser/parser.java`

### Token contract

- [Token symbols](https://github.com/devrodofc/analisador-lexico/blob/main/gen/parser/sym.java): `gen/parser/sym.java`

### Other components

- **User**
- **Console output**

## Connections

- User → Compiler entry: runs (evidence: `README.md`)
- Compiler entry → Source input: reads (evidence: `src/Main.java`)
- Compiler entry → Lexical scanner: creates (evidence: `src/Main.java`)
- Compiler entry → Syntax and actions: starts (evidence: `src/Main.java`)
- Syntax and actions → Lexical scanner: pulls tokens (evidence: `gen/parser/parser.java`)
- Lexical scanner → Token symbols: uses tokens (evidence: `gen/lexer/Lexer.java`)
- Syntax and actions → Token symbols: defines symbols (evidence: `gen/parser/parser.java`)
- Syntax and actions → Console output: prints actions (evidence: `gen/parser/parser.java`)
- Compiler entry → Console output: prints status (evidence: `src/Main.java`)
