# pablohsgc/interpretador-miniphp-feito-em-java architecture

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

- Interactive diagram: https://gitdiagram.com/pablohsgc/interpretador-miniphp-feito-em-java
- Repository: https://github.com/pablohsgc/interpretador-miniphp-feito-em-java

## Overview

This is a Java mini-PHP interpreter for basic programming operations. The principal workflow is a user-supplied source file being tokenized, parsed into command and expression objects, then interpreted. The graph distinguishes lexical analysis, syntax construction, executable commands, expression evaluation, and runtime values. The README gives only a brief product description; several links therefore show parser construction or module references rather than a fully verified execution path. Unsampled runtime wiring is omitted where the evidence does not establish it.

Main entry points: [`src/syntatic/SyntaticAnalysis.java`](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/syntatic/SyntaticAnalysis.java) (Syntax Parser), [`src/lexical/LexicalAnalysis.java`](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/LexicalAnalysis.java) (Tokenizer), [`src/interpreter/value/Value.java`](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/Value.java) (Value Types), [`src/interpreter/command/AssignCmd.java`](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/AssignCmd.java) (Command Types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Language Front End"]
  node_lexer["Tokenizer"]
  node_tokens["Token Definitions<br/>[TokenType.java]"]
  node_lexeme["Lexeme Records<br/>[Lexeme.java]"]
  node_symboltable["Symbol Table<br/>[SymbolTable.java]"]
  node_parser["Syntax Parser"]
end

subgraph group_syntax["Syntax and Commands"]
  node_commands["Command Types<br/>[AssignCmd.java]"]
  node_blocks["Command Blocks<br/>[BlocksCommand.java]"]
  node_control["Control Flow<br/>[IfCommand.java]"]
  node_loops["Loop Commands"]
  node_echo["Output Command<br/>[EchoCommand.java]"]
end

subgraph group_eval["Expressions"]
  node_expr["Arithmetic Expressions<br/>[BinaryExpr.java]"]
  node_bool["Boolean Expressions<br/>[BoolExpr.java]"]
  node_variables["Variables and Access<br/>[Variable.java]"]
  node_arrays["Array Expressions<br/>[ArrayExpr.java]"]
end

subgraph group_runtime["Runtime Values"]
  node_values["Value Types<br/>[Value.java]"]
  node_arrayvalue["Array Values<br/>[ArrayValue.java]"]
  node_primitive["Primitive Values<br/>[IntegerValue.java]"]
end

node_user(("Source Author"))
node_cli["Interpreter Entry<br/>[mphpi.java]"]

node_user -->|"runs interpreter"| node_cli
node_cli -->|"starts parsing"| node_parser
node_parser -->|"requests tokens"| node_lexer
node_lexer -->|"classifies tokens"| node_tokens
node_lexer -->|"creates lexemes"| node_lexeme
node_lexer -->|"uses symbols"| node_symboltable
node_parser -->|"builds commands"| node_commands
node_parser -->|"builds blocks"| node_blocks
node_parser -->|"builds branches"| node_control
node_parser -->|"builds loops"| node_loops
node_parser -->|"builds output"| node_echo
node_parser -->|"builds expressions"| node_expr
node_parser -->|"builds conditions"| node_bool
node_parser -->|"builds variable access"| node_variables
node_parser -->|"builds arrays"| node_arrays
node_commands -->|"assigns through"| node_variables
node_commands -->|"creates values"| node_primitive
node_expr -->|"evaluates to"| node_values
node_variables -->|"stores value"| node_values
node_arrays -->|"creates array value"| node_arrayvalue
node_arrayvalue -->|"contains values"| node_values
node_primitive -->|"extends value"| node_values

click node_cli "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/mphpi.java"
click node_lexer "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/LexicalAnalysis.java"
click node_tokens "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/TokenType.java"
click node_lexeme "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/Lexeme.java"
click node_symboltable "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/SymbolTable.java"
click node_parser "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/syntatic/SyntaticAnalysis.java"
click node_commands "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/AssignCmd.java"
click node_blocks "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/BlocksCommand.java"
click node_control "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/IfCommand.java"
click node_loops "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/ForeachCommand.java"
click node_echo "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/EchoCommand.java"
click node_expr "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/BinaryExpr.java"
click node_bool "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/BoolExpr.java"
click node_variables "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/Variable.java"
click node_arrays "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/ArrayExpr.java"
click node_values "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/Value.java"
click node_arrayvalue "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/ArrayValue.java"
click node_primitive "https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/IntegerValue.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_lexer,node_tokens,node_lexeme,node_symboltable,node_parser toneBlue
class node_commands,node_blocks,node_control,node_loops,node_echo toneAmber
class node_expr,node_bool,node_variables,node_arrays toneMint
class node_values,node_arrayvalue,node_primitive toneRose
class node_user toneIndigo
class node_cli toneTeal
```

## Components

### Language Front End

- [Tokenizer](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/LexicalAnalysis.java): `src/lexical/LexicalAnalysis.java`
- [Token Definitions](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/TokenType.java): `src/lexical/TokenType.java`
- [Lexeme Records](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/Lexeme.java): `src/lexical/Lexeme.java`
- [Symbol Table](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/lexical/SymbolTable.java): `src/lexical/SymbolTable.java`
- [Syntax Parser](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/syntatic/SyntaticAnalysis.java): `src/syntatic/SyntaticAnalysis.java`

### Syntax and Commands

- [Command Types](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/AssignCmd.java): `src/interpreter/command/AssignCmd.java`
- [Command Blocks](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/BlocksCommand.java): `src/interpreter/command/BlocksCommand.java`
- [Control Flow](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/IfCommand.java): `src/interpreter/command/IfCommand.java`
- [Loop Commands](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/ForeachCommand.java): `src/interpreter/command/ForeachCommand.java`
- [Output Command](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/command/EchoCommand.java): `src/interpreter/command/EchoCommand.java`

### Expressions

- [Arithmetic Expressions](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/BinaryExpr.java): `src/interpreter/expr/BinaryExpr.java`
- [Boolean Expressions](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/BoolExpr.java): `src/interpreter/expr/BoolExpr.java`
- [Variables and Access](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/Variable.java): `src/interpreter/expr/Variable.java`
- [Array Expressions](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/expr/ArrayExpr.java): `src/interpreter/expr/ArrayExpr.java`

### Runtime Values

- [Value Types](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/Value.java): `src/interpreter/value/Value.java`
- [Array Values](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/ArrayValue.java): `src/interpreter/value/ArrayValue.java`
- [Primitive Values](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/interpreter/value/IntegerValue.java): `src/interpreter/value/IntegerValue.java`

### Other components

- **Source Author**
- [Interpreter Entry](https://github.com/pablohsgc/interpretador-miniphp-feito-em-java/blob/main/src/mphpi.java): `src/mphpi.java`

## Connections

- Source Author → Interpreter Entry: runs interpreter (evidence: `README.md`)
- Interpreter Entry → Syntax Parser: starts parsing (evidence: `src/mphpi.java`)
- Syntax Parser → Tokenizer: requests tokens (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Tokenizer → Token Definitions: classifies tokens (evidence: `src/lexical/LexicalAnalysis.java`)
- Tokenizer → Lexeme Records: creates lexemes (evidence: `src/lexical/LexicalAnalysis.java`)
- Tokenizer → Symbol Table: uses symbols (evidence: `src/lexical/LexicalAnalysis.java`)
- Syntax Parser → Command Types: builds commands (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Command Blocks: builds blocks (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Control Flow: builds branches (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Loop Commands: builds loops (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Output Command: builds output (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Arithmetic Expressions: builds expressions (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Boolean Expressions: builds conditions (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Variables and Access: builds variable access (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Syntax Parser → Array Expressions: builds arrays (evidence: `src/syntatic/SyntaticAnalysis.java`)
- Command Types → Variables and Access: assigns through (evidence: `src/interpreter/command/AssignCmd.java`)
- Command Types → Primitive Values: creates values (evidence: `src/interpreter/command/AssignCmd.java`)
- Arithmetic Expressions → Value Types: evaluates to (evidence: `src/interpreter/expr/BinaryExpr.java`)
- Variables and Access → Value Types: stores value (evidence: `src/interpreter/expr/Variable.java`)
- Array Expressions → Array Values: creates array value (evidence: `src/interpreter/expr/ArrayExpr.java`)
- Array Values → Value Types: contains values (evidence: `src/interpreter/value/ArrayValue.java`)
- Primitive Values → Value Types: extends value (evidence: `src/interpreter/value/IntegerValue.java`)
