# syedmahihossen/compilertoolkit architecture

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

- Interactive diagram: https://gitdiagram.com/syedmahihossen/compilertoolkit
- Repository: https://github.com/syedmahihossen/compilertoolkit

## Overview

Compiler Toolkit is a browser-based workbench for entering grammars, inspecting analysis results, and applying grammar transformations. Its documented core capabilities are FIRST/FOLLOW computation, LL(1) table generation with conflict detection, left-recursion removal, and left factoring; the sampled JavaScript also includes a regex tester. The excerpts show grammar parsing and FIRST/FOLLOW UI wiring, plus rendering helpers. Other documented features are retained, but their internal call paths are not established by the excerpts.

Main entry points: [`tools.html`](https://github.com/syedmahihossen/compilertoolkit/blob/main/tools.html) (Workbench UI), [`js/tools.js`](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js) (UI Event Handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Workbench"]
  node_workbench["Workbench UI<br/>[tools.html]"]
  node_ui_control["UI Event Handlers<br/>[tools.js]"]
  node_result_rendering["Result Rendering<br/>[tools.js]"]
end

subgraph group_grammar["Grammar Processing"]
  node_grammar_input["Grammar Input<br/>[tools.html]"]
  node_grammar_parser["Grammar Parser<br/>[tools.js]"]
  node_symbol_analysis["Symbol Identification<br/>[tools.js]"]
  node_lr_removal["Left Recursion Removal<br/>[tools.js]"]
  node_left_factoring["Left Factoring<br/>[tools.js]"]
end

subgraph group_analysis["Grammar Analysis"]
  node_first_follow["FIRST and FOLLOW<br/>[tools.js]"]
  node_ll_table["LL&#40;1&#41; Table<br/>[tools.js]"]
  node_conflicts["Conflict Detection<br/>[tools.js]"]
end

subgraph group_extras["Additional Tools"]
  node_regex_tester["Regex Tester<br/>[tools.js]"]
end

node_user(("Student or Developer"))

node_user -->|"uses"| node_workbench
node_workbench -->|"accepts grammar"| node_grammar_input
node_workbench -.->|"uses handlers"| node_ui_control
node_ui_control -->|"parses input"| node_grammar_parser
node_grammar_parser -->|"provides productions"| node_first_follow
node_ui_control -->|"computes sets"| node_first_follow
node_first_follow -->|"identifies symbols"| node_symbol_analysis
node_ui_control -->|"renders results"| node_result_rendering
node_workbench -->|"offers table generation"| node_ll_table
node_ll_table -->|"detects collisions"| node_conflicts
node_workbench -->|"offers transformation"| node_lr_removal
node_workbench -->|"offers transformation"| node_left_factoring
node_workbench -.->|"offers tester"| node_regex_tester

click node_workbench "https://github.com/syedmahihossen/compilertoolkit/blob/main/tools.html"
click node_ui_control "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_grammar_input "https://github.com/syedmahihossen/compilertoolkit/blob/main/tools.html"
click node_grammar_parser "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_symbol_analysis "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_first_follow "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_ll_table "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_conflicts "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_lr_removal "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_left_factoring "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_result_rendering "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"
click node_regex_tester "https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js"

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_workbench,node_ui_control,node_result_rendering toneBlue
class node_grammar_input,node_grammar_parser,node_symbol_analysis,node_lr_removal,node_left_factoring toneAmber
class node_first_follow,node_ll_table,node_conflicts toneMint
class node_regex_tester toneRose
class node_user toneIndigo
```

## Components

### Workbench

- [Workbench UI](https://github.com/syedmahihossen/compilertoolkit/blob/main/tools.html): `tools.html`
- [UI Event Handlers](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [Result Rendering](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`

### Grammar Processing

- [Grammar Input](https://github.com/syedmahihossen/compilertoolkit/blob/main/tools.html): `tools.html`
- [Grammar Parser](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [Symbol Identification](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [Left Recursion Removal](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [Left Factoring](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`

### Grammar Analysis

- [FIRST and FOLLOW](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [LL(1) Table](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`
- [Conflict Detection](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`

### Additional Tools

- [Regex Tester](https://github.com/syedmahihossen/compilertoolkit/blob/main/js/tools.js): `js/tools.js`

### Other components

- **Student or Developer**

## Connections

- Student or Developer → Workbench UI: uses (evidence: `README.md`)
- Workbench UI → Grammar Input: accepts grammar (evidence: `README.md`)
- Workbench UI → UI Event Handlers: uses handlers
- UI Event Handlers → Grammar Parser: parses input (evidence: `js/tools.js`)
- Grammar Parser → FIRST and FOLLOW: provides productions (evidence: `js/tools.js`)
- UI Event Handlers → FIRST and FOLLOW: computes sets (evidence: `js/tools.js`)
- FIRST and FOLLOW → Symbol Identification: identifies symbols (evidence: `js/tools.js`)
- UI Event Handlers → Result Rendering: renders results (evidence: `js/tools.js`)
- Workbench UI → LL(1) Table: offers table generation (evidence: `README.md`)
- LL(1) Table → Conflict Detection: detects collisions (evidence: `README.md`)
- Workbench UI → Left Recursion Removal: offers transformation (evidence: `README.md`)
- Workbench UI → Left Factoring: offers transformation (evidence: `README.md`)
- Workbench UI → Regex Tester: offers tester
