# mhmdvoid/uqucompiler architecture

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

- Interactive diagram: https://gitdiagram.com/mhmdvoid/uqucompiler
- Repository: https://github.com/mhmdvoid/uqucompiler

## Overview

UQUCompiler is an in-development Java compiler for UQULang, described as targeting MIPS. Its intended workflow is source input, lexing, parsing into an AST, then semantic name resolution and type checking. The tree also shows scope and type infrastructure supporting those semantic stages. No code-generation implementation or end-to-end driver is evidenced here, so the graph does not invent a complete path to MIPS output. Some relationships are supported only by the SOURCE INDEX or README; unsampled behavior is not treated as inspected.

Main entry points: [`src/main/java/semantic/type_checking/TypeChecker.java`](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeChecker.java) (Type Checker), [`src/main/java/parser/Parser.java`](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/parser/Parser.java) (Parser), [`src/main/java/ast/nodes`](https://github.com/mhmdvoid/uqucompiler/tree/main/src/main/java/ast/nodes) (AST Nodes), [`src/main/java/semantic/redesign/ScopeService.java`](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/redesign/ScopeService.java) (Scope Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Source Front End"]
  node_source["Source Manager<br/>[SourceManager.java]"]
  node_reader["Reader<br/>[Reader.java]"]
  node_lexer["Lexer<br/>[Lexer.java]"]
  node_parser["Parser<br/>[Parser.java]"]
end

subgraph group_syntax["Syntax Model"]
  node_ast["AST Nodes"]
  node_astinfo["AST Type Factory<br/>[ASTInfo.java]"]
  node_exprwalk["Expression Walker<br/>[ExprWalker.java]"]
  node_types["Type Model"]
end

subgraph group_semantics["Semantic Analysis"]
  node_scope["Scope Service<br/>[ScopeService.java]"]
  node_adtscope["ADT Scopes<br/>[ADTScope.java]"]
  node_binder["Name Binder<br/>[NameBinder.java]"]
  node_sema["Semantic Analysis<br/>[Sema.java]"]
  node_semaexpr["Expression Semantics<br/>[SemaExpr.java]"]
  node_typecheck["Type Checker<br/>[TypeChecker.java]"]
  node_typecheckdecl["Declaration Type Check<br/>[TypeCheckDecl.java]"]
  node_typecheckexpr["Expression Type Check<br/>[TypeCheckExpr.java]"]
  node_typechecktype["Type Type Check<br/>[TypeCheckType.java]"]
  node_oldscope["Scope Hierarchy<br/>[Scope.java]"]
end

subgraph group_support["Compiler Support"]
  node_compilerio["Compiler I/O<br/>[CompilerIO.java]"]
  node_errors["Error Logger<br/>[ErrorLogger.java]"]
end

node_author(("Language User"))

node_author -.->|"provides source"| node_source
node_source -->|"reads through"| node_reader
node_parser -->|"uses tokens"| node_lexer
node_parser -->|"builds syntax"| node_ast
node_parser -->|"consults scopes"| node_scope
node_astinfo -->|"creates built-ins"| node_types
node_exprwalk -->|"walks expressions"| node_ast
node_scope -->|"manages scopes"| node_adtscope
node_binder -->|"resolves references"| node_ast
node_binder -.->|"uses scope service"| node_scope
node_sema -.->|"analyzes expressions"| node_semaexpr
node_semaexpr -->|"queries scope"| node_oldscope
node_typecheck -.->|"checks declarations"| node_typecheckdecl
node_typecheck -.->|"checks expressions"| node_typecheckexpr
node_typecheck -.->|"checks types"| node_typechecktype
node_typecheck -->|"checks translation unit"| node_ast
node_typecheck -->|"uses type model"| node_types
node_parser -->|"reports syntax errors"| node_errors

click node_source "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/SourceManager.java"
click node_reader "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/Reader.java"
click node_lexer "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/Lexer.java"
click node_parser "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/parser/Parser.java"
click node_ast "https://github.com/mhmdvoid/uqucompiler/tree/main/src/main/java/ast/nodes"
click node_astinfo "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/ast/nodes/ASTInfo.java"
click node_exprwalk "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/ast/nodes/visitor/ExprWalker.java"
click node_types "https://github.com/mhmdvoid/uqucompiler/tree/main/src/main/java/ast/type"
click node_scope "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/redesign/ScopeService.java"
click node_adtscope "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/redesign/ADTScope.java"
click node_binder "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/NameBinder.java"
click node_sema "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/Sema.java"
click node_semaexpr "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/SemaExpr.java"
click node_typecheck "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeChecker.java"
click node_typecheckdecl "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckDecl.java"
click node_typecheckexpr "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckExpr.java"
click node_typechecktype "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckType.java"
click node_oldscope "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/scope/Scope.java"
click node_compilerio "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/compile/CompilerIO.java"
click node_errors "https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lex_erro_log/ErrorLogger.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_source,node_reader,node_lexer,node_parser,node_author toneBlue
class node_ast,node_astinfo,node_exprwalk,node_types toneAmber
class node_scope,node_adtscope,node_binder,node_sema,node_semaexpr,node_typecheck,node_typecheckdecl,node_typecheckexpr,node_typechecktype,node_oldscope toneMint
class node_compilerio,node_errors toneRose
```

## Components

### Source Front End

- [Source Manager](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/SourceManager.java): `src/main/java/lexer/SourceManager.java`
- [Reader](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/Reader.java): `src/main/java/lexer/Reader.java`
- [Lexer](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lexer/Lexer.java): `src/main/java/lexer/Lexer.java`
- [Parser](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/parser/Parser.java): `src/main/java/parser/Parser.java`

### Syntax Model

- [AST Nodes](https://github.com/mhmdvoid/uqucompiler/tree/main/src/main/java/ast/nodes): `src/main/java/ast/nodes`
- [AST Type Factory](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/ast/nodes/ASTInfo.java): `src/main/java/ast/nodes/ASTInfo.java`
- [Expression Walker](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/ast/nodes/visitor/ExprWalker.java): `src/main/java/ast/nodes/visitor/ExprWalker.java`
- [Type Model](https://github.com/mhmdvoid/uqucompiler/tree/main/src/main/java/ast/type): `src/main/java/ast/type`

### Semantic Analysis

- [Scope Service](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/redesign/ScopeService.java): `src/main/java/semantic/redesign/ScopeService.java`
- [ADT Scopes](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/redesign/ADTScope.java): `src/main/java/semantic/redesign/ADTScope.java`
- [Name Binder](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/NameBinder.java): `src/main/java/semantic/NameBinder.java`
- [Semantic Analysis](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/Sema.java): `src/main/java/semantic/Sema.java`
- [Expression Semantics](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/SemaExpr.java): `src/main/java/semantic/SemaExpr.java`
- [Type Checker](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeChecker.java): `src/main/java/semantic/type_checking/TypeChecker.java`
- [Declaration Type Check](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckDecl.java): `src/main/java/semantic/type_checking/TypeCheckDecl.java`
- [Expression Type Check](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckExpr.java): `src/main/java/semantic/type_checking/TypeCheckExpr.java`
- [Type Type Check](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/type_checking/TypeCheckType.java): `src/main/java/semantic/type_checking/TypeCheckType.java`
- [Scope Hierarchy](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/semantic/scope/Scope.java): `src/main/java/semantic/scope/Scope.java`

### Compiler Support

- [Compiler I/O](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/compile/CompilerIO.java): `src/main/java/compile/CompilerIO.java`
- [Error Logger](https://github.com/mhmdvoid/uqucompiler/blob/main/src/main/java/lex_erro_log/ErrorLogger.java): `src/main/java/lex_erro_log/ErrorLogger.java`

### Other components

- **Language User**

## Connections

- Language User → Source Manager: provides source
- Source Manager → Reader: reads through (evidence: `src/main/java/lexer/SourceManager.java`)
- Parser → Lexer: uses tokens (evidence: `src/main/java/parser/Parser.java`)
- Parser → AST Nodes: builds syntax (evidence: `src/main/java/parser/Parser.java`)
- Parser → Scope Service: consults scopes (evidence: `src/main/java/parser/Parser.java`)
- AST Type Factory → Type Model: creates built-ins (evidence: `src/main/java/ast/nodes/ASTInfo.java`)
- Expression Walker → AST Nodes: walks expressions (evidence: `src/main/java/ast/nodes/visitor/ExprWalker.java`)
- Scope Service → ADT Scopes: manages scopes (evidence: `src/main/java/semantic/redesign/ScopeService.java`)
- Name Binder → AST Nodes: resolves references (evidence: `src/main/java/semantic/NameBinder.java`)
- Name Binder → Scope Service: uses scope service
- Semantic Analysis → Expression Semantics: analyzes expressions (evidence: `src/main/java/semantic/SemaExpr.java`)
- Expression Semantics → Scope Hierarchy: queries scope (evidence: `src/main/java/semantic/SemaExpr.java`)
- Type Checker → Declaration Type Check: checks declarations
- Type Checker → Expression Type Check: checks expressions
- Type Checker → Type Type Check: checks types (evidence: `src/main/java/semantic/type_checking/TypeCheckType.java`)
- Type Checker → AST Nodes: checks translation unit (evidence: `src/main/java/semantic/type_checking/TypeChecker.java`)
- Type Checker → Type Model: uses type model (evidence: `src/main/java/semantic/type_checking/TypeChecker.java`)
- Parser → Error Logger: reports syntax errors (evidence: `src/main/java/parser/Parser.java`)
