# tg11-org/plt architecture

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

- Interactive diagram: https://gitdiagram.com/tg11-org/plt
- Repository: https://github.com/tg11-org/plt

## Overview

PLT is an experimental source-to-source translator. A user selects a source and target language through the CLI; the CLI reads the source, dispatches to a frontend to produce language-neutral IR, optionally prints that IR, and dispatches the IR to a backend that emits target code. The documented principal route is JavaScript to Python or C; the CLI and source index also show Python/C# frontends and a Tcl backend. Arrows are limited to README statements and shown CLI/frontend/backend code; unsampled capabilities are not inferred.

Main entry points: [`src/PLT/PLT.CLI/Program.cs`](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CLI/Program.cs) (CLI dispatcher), [`src/PLT/PLT.CORE/IR/Nodes.cs`](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/IR/Nodes.cs) (IR model), [`src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs`](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs) (JavaScript frontend), [`src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs`](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs) (Python frontend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli["CLI dispatcher<br/>[Program.cs]"]
end

subgraph group_frontends["Source frontends"]
  node_js_frontend["JavaScript frontend<br/>[MiniJsFrontend.cs]"]
  node_python_frontend["Python frontend<br/>[PythonFrontend.cs]"]
  node_csharp_frontend["C&#35; frontend<br/>[CSharpFrontend.cs]"]
end

subgraph group_ir["Intermediate representation"]
  node_ir_model["IR model<br/>[Nodes.cs]"]
  node_ir_printer["IR pretty printer<br/>[PrettyPrinter.cs]"]
end

subgraph group_backends["Target backends"]
  node_python_emitter["Python emitter<br/>[PythonEmitter.cs]"]
  node_c_emitter["C emitter<br/>[CEmitter.cs]"]
  node_tcl_emitter["Tcl emitter<br/>[TclEmitter.cs]"]
end

node_user(("Translator user"))
node_translated_output["Translated source"]

node_user -->|"selects languages"| node_cli
node_cli -->|"dispatches to"| node_js_frontend
node_cli -->|"dispatches to"| node_python_frontend
node_cli -->|"dispatches to"| node_csharp_frontend
node_js_frontend -->|"constructs"| node_ir_model
node_python_frontend -->|"produces"| node_ir_model
node_csharp_frontend -->|"produces"| node_ir_model
node_cli -->|"prints optionally"| node_ir_printer
node_ir_model -->|"formats"| node_ir_printer
node_cli -->|"dispatches to"| node_python_emitter
node_cli -->|"dispatches to"| node_c_emitter
node_cli -->|"dispatches to"| node_tcl_emitter
node_ir_model -->|"emits from"| node_python_emitter
node_ir_model -->|"emits from"| node_c_emitter
node_ir_model -->|"emits from"| node_tcl_emitter
node_cli -->|"writes or prints"| node_translated_output

click node_cli "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CLI/Program.cs"
click node_js_frontend "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs"
click node_python_frontend "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs"
click node_csharp_frontend "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/CSharp/CSharpFrontend.cs"
click node_ir_model "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/IR/Nodes.cs"
click node_ir_printer "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/IR/PrettyPrinter.cs"
click node_python_emitter "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/Python/PythonEmitter.cs"
click node_c_emitter "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/C/CEmitter.cs"
click node_tcl_emitter "https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/Tcl/TclEmitter.cs"

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_cli,node_user toneBlue
class node_js_frontend,node_python_frontend,node_csharp_frontend toneAmber
class node_ir_model,node_ir_printer toneMint
class node_python_emitter,node_c_emitter,node_tcl_emitter toneRose
class node_translated_output toneIndigo
```

## Components

### Command line

- [CLI dispatcher](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CLI/Program.cs): `src/PLT/PLT.CLI/Program.cs`

### Source frontends

- [JavaScript frontend](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs): `src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs`
- [Python frontend](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs): `src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs`
- [C# frontend](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Frontends/CSharp/CSharpFrontend.cs): `src/PLT/PLT.CORE/Frontends/CSharp/CSharpFrontend.cs`

### Intermediate representation

- [IR model](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/IR/Nodes.cs): `src/PLT/PLT.CORE/IR/Nodes.cs`
- [IR pretty printer](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/IR/PrettyPrinter.cs): `src/PLT/PLT.CORE/IR/PrettyPrinter.cs`

### Target backends

- [Python emitter](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/Python/PythonEmitter.cs): `src/PLT/PLT.CORE/Backends/Python/PythonEmitter.cs`
- [C emitter](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/C/CEmitter.cs): `src/PLT/PLT.CORE/Backends/C/CEmitter.cs`
- [Tcl emitter](https://github.com/tg11-org/plt/blob/master/src/PLT/PLT.CORE/Backends/Tcl/TclEmitter.cs): `src/PLT/PLT.CORE/Backends/Tcl/TclEmitter.cs`

### Other components

- **Translator user**
- **Translated source**

## Connections

- Translator user → CLI dispatcher: selects languages (evidence: `README.md`)
- CLI dispatcher → JavaScript frontend: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- CLI dispatcher → Python frontend: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- CLI dispatcher → C# frontend: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- JavaScript frontend → IR model: constructs (evidence: `src/PLT/PLT.CORE/Frontends/Js/MiniJsFrontend.cs`)
- Python frontend → IR model: produces (evidence: `src/PLT/PLT.CORE/Frontends/Python/PythonFrontend.cs`)
- C# frontend → IR model: produces (evidence: `src/PLT/PLT.CORE/Frontends/CSharp/CSharpFrontend.cs`)
- CLI dispatcher → IR pretty printer: prints optionally (evidence: `src/PLT/PLT.CLI/Program.cs`)
- IR model → IR pretty printer: formats (evidence: `src/PLT/PLT.CORE/IR/PrettyPrinter.cs`)
- CLI dispatcher → Python emitter: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- CLI dispatcher → C emitter: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- CLI dispatcher → Tcl emitter: dispatches to (evidence: `src/PLT/PLT.CLI/Program.cs`)
- IR model → Python emitter: emits from (evidence: `src/PLT/PLT.CORE/Backends/Python/PythonEmitter.cs`)
- IR model → C emitter: emits from (evidence: `src/PLT/PLT.CORE/Backends/C/CEmitter.cs`)
- IR model → Tcl emitter: emits from (evidence: `src/PLT/PLT.CORE/Backends/Tcl/TclEmitter.cs`)
- CLI dispatcher → Translated source: writes or prints (evidence: `src/PLT/PLT.CLI/Program.cs`)
