# raiyanjubaerrohan/little-spiders architecture

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

- Interactive diagram: https://gitdiagram.com/raiyanjubaerrohan/little-spiders
- Repository: https://github.com/raiyanjubaerrohan/little-spiders

## Overview

Little-spiders is a small compiler front end for its own C-like language. The user supplies a source file to the CLI; the driver coordinates lexing/parsing, name and scope resolution, semantic type handling, and AST code generation, then writes LLVM IR. The README describes clang as the next step for compiling that IR, but the sampled driver only emits IR. The graph reflects the shown driver order and module references; unsampled parser and AST behavior is not inferred beyond those references.

Main entry points: [`main.py`](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/main.py) (Compiler Driver), [`nodes.py`](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/nodes.py) (AST and Codegen), [`parserize.py`](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/parserize.py) (Parser), [`resolvistics.py`](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/resolvistics.py) (Name Resolver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Language Front End"]
  node_lexer["Lexer<br/>[lexical.py]"]
  node_parser["Parser<br/>[parserize.py]"]
end

subgraph group_analysis["Semantic Analysis"]
  node_resolver["Name Resolver<br/>[resolvistics.py]"]
  node_semantic["Type Semanticizer<br/>[symantics.py]"]
end

subgraph group_codegen["IR Generation"]
  node_ast["AST and Codegen<br/>[nodes.py]"]
end

subgraph group_runtime["Driver and Output"]
  node_driver["Compiler Driver<br/>[main.py]"]
  node_context["Compiler Context<br/>[utils.py]"]
  node_ir["LLVM IR Output<br/>[main.py]"]
end

node_author(("Source Author"))
node_clang["clang"]

node_author -->|"provides source"| node_driver
node_driver -->|"configures and parses"| node_parser
node_parser -->|"uses"| node_lexer
node_parser -->|"constructs nodes"| node_ast
node_driver -->|"resolves each node"| node_resolver
node_resolver -->|"resolves symbols"| node_ast
node_driver -->|"checks each node"| node_semantic
node_semantic -->|"types and rewrites"| node_ast
node_driver -->|"initializes"| node_context
node_resolver -->|"looks up functions"| node_context
node_driver -->|"invokes codegen"| node_ast
node_ast -->|"emits instructions"| node_context
node_driver -->|"writes module"| node_ir
node_ir -.->|"compiled by"| node_clang

click node_driver "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/main.py"
click node_lexer "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/lexical.py"
click node_parser "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/parserize.py"
click node_ast "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/nodes.py"
click node_resolver "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/resolvistics.py"
click node_semantic "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/symantics.py"
click node_context "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/utils.py"
click node_ir "https://github.com/raiyanjubaerrohan/little-spiders/blob/main/main.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_lexer,node_parser toneBlue
class node_resolver,node_semantic toneAmber
class node_ast toneMint
class node_driver,node_context,node_ir toneRose
class node_author,node_clang toneIndigo
```

## Components

### Language Front End

- [Lexer](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/lexical.py): `lexical.py`
- [Parser](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/parserize.py): `parserize.py`

### Semantic Analysis

- [Name Resolver](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/resolvistics.py): `resolvistics.py`
- [Type Semanticizer](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/symantics.py): `symantics.py`

### IR Generation

- [AST and Codegen](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/nodes.py): `nodes.py`

### Driver and Output

- [Compiler Driver](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/main.py): `main.py`
- [Compiler Context](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/utils.py): `utils.py`
- [LLVM IR Output](https://github.com/raiyanjubaerrohan/little-spiders/blob/main/main.py): `main.py`

### Other components

- **Source Author**
- **clang**

## Connections

- Source Author → Compiler Driver: provides source (evidence: `README.md`)
- Compiler Driver → Parser: configures and parses (evidence: `main.py`)
- Parser → Lexer: uses (evidence: `parserize.py`)
- Parser → AST and Codegen: constructs nodes (evidence: `parserize.py`)
- Compiler Driver → Name Resolver: resolves each node (evidence: `main.py`)
- Name Resolver → AST and Codegen: resolves symbols (evidence: `resolvistics.py`)
- Compiler Driver → Type Semanticizer: checks each node (evidence: `main.py`)
- Type Semanticizer → AST and Codegen: types and rewrites (evidence: `symantics.py`)
- Compiler Driver → Compiler Context: initializes (evidence: `main.py`)
- Name Resolver → Compiler Context: looks up functions (evidence: `resolvistics.py`)
- Compiler Driver → AST and Codegen: invokes codegen (evidence: `main.py`)
- AST and Codegen → Compiler Context: emits instructions (evidence: `nodes.py`)
- Compiler Driver → LLVM IR Output: writes module (evidence: `main.py`)
- LLVM IR Output → clang: compiled by (evidence: `README.md`)
