# elis3o2/dsl-prob architecture

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

- Interactive diagram: https://gitdiagram.com/elis3o2/dsl-prob
- Repository: https://github.com/elis3o2/dsl-prob

## Overview

Prob is a Haskell interpreter for a probability DSL. Its documented user workflow is to run a .prob script or use the REPL, then evaluate declarations and commands such as print, table, plot, probability queries, Markov-chain queries, and simulation. The graph preserves the corresponding language, distribution, Markov, and presentation components. No source excerpts were supplied, so internal call relationships are omitted; dashed edges with no evidence mark only broad, unverified runtime relationships. The README documents gnuplot and Graphviz as plotting dependencies.

Main entry points: [`src/Plot.hs`](https://github.com/elis3o2/dsl-prob/blob/main/src/Plot.hs) (Plotting), [`app/Main.hs`](https://github.com/elis3o2/dsl-prob/blob/main/app/Main.hs) (Interpreter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interpreter entry"]
  node_interpreter["Interpreter<br/>[Main.hs]"]
end

subgraph group_language["Language processing"]
  node_parser["Parser<br/>[Parse.hs]"]
  node_syntax["AST<br/>[AST.hs]"]
  node_validation["Validation<br/>[Validator.hs]"]
  node_typecheck["Type checker<br/>[TypeChecker.hs]"]
  node_evaluation["Evaluation<br/>[Eval.hs]"]
  node_runtime["Runtime support<br/>[Monad.hs]"]
  node_errors["Errors<br/>[Error.hs]"]
  node_common["Shared definitions<br/>[Common.hs]"]
  node_globals["Global state<br/>[Global.hs]"]
end

subgraph group_probability["Probability domain"]
  node_distribution["Distributions<br/>[Distribution.hs]"]
  node_binary["Binary operations<br/>[CBin.hs]"]
end

subgraph group_markov["Markov analysis"]
  node_markov["Markov chains<br/>[Markov.hs]"]
  node_matrix["Matrix operations<br/>[Matrix.hs]"]
  node_simulation["Simulation<br/>[Simulation.hs]"]
end

subgraph group_output["Results and presentation"]
  node_tables["Probability tables<br/>[Table.hs]"]
  node_plotting["Plotting<br/>[Plot.hs]"]
  node_printing["Pretty printing<br/>[PPrint.hs]"]
end

node_user(("Script / REPL user"))
node_gnuplot["gnuplot"]
node_graphviz["Graphviz"]

node_user -->|"runs scripts / REPL"| node_interpreter
node_plotting -->|"plots distributions"| node_gnuplot
node_plotting -->|"plots chains"| node_graphviz

click node_interpreter "https://github.com/elis3o2/dsl-prob/blob/main/app/Main.hs"
click node_parser "https://github.com/elis3o2/dsl-prob/blob/main/src/Parse.hs"
click node_syntax "https://github.com/elis3o2/dsl-prob/blob/main/src/AST.hs"
click node_validation "https://github.com/elis3o2/dsl-prob/blob/main/src/Validator.hs"
click node_typecheck "https://github.com/elis3o2/dsl-prob/blob/main/src/TypeChecker.hs"
click node_evaluation "https://github.com/elis3o2/dsl-prob/blob/main/src/Eval.hs"
click node_runtime "https://github.com/elis3o2/dsl-prob/blob/main/src/Monad.hs"
click node_errors "https://github.com/elis3o2/dsl-prob/blob/main/src/Error.hs"
click node_common "https://github.com/elis3o2/dsl-prob/blob/main/src/Common.hs"
click node_globals "https://github.com/elis3o2/dsl-prob/blob/main/src/Global.hs"
click node_distribution "https://github.com/elis3o2/dsl-prob/blob/main/src/Distribution.hs"
click node_binary "https://github.com/elis3o2/dsl-prob/blob/main/src/CBin.hs"
click node_markov "https://github.com/elis3o2/dsl-prob/blob/main/src/Markov.hs"
click node_matrix "https://github.com/elis3o2/dsl-prob/blob/main/src/Matrix.hs"
click node_simulation "https://github.com/elis3o2/dsl-prob/blob/main/src/Simulation.hs"
click node_tables "https://github.com/elis3o2/dsl-prob/blob/main/src/Table.hs"
click node_plotting "https://github.com/elis3o2/dsl-prob/blob/main/src/Plot.hs"
click node_printing "https://github.com/elis3o2/dsl-prob/blob/main/src/PPrint.hs"

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_interpreter,node_user toneBlue
class node_parser,node_syntax,node_validation,node_typecheck,node_evaluation,node_runtime,node_errors,node_common,node_globals toneAmber
class node_distribution,node_binary toneMint
class node_markov,node_matrix,node_simulation toneRose
class node_tables,node_plotting,node_printing,node_gnuplot,node_graphviz toneIndigo
```

## Components

### Interpreter entry

- [Interpreter](https://github.com/elis3o2/dsl-prob/blob/main/app/Main.hs): `app/Main.hs`

### Language processing

- [Parser](https://github.com/elis3o2/dsl-prob/blob/main/src/Parse.hs): `src/Parse.hs`
- [AST](https://github.com/elis3o2/dsl-prob/blob/main/src/AST.hs): `src/AST.hs`
- [Validation](https://github.com/elis3o2/dsl-prob/blob/main/src/Validator.hs): `src/Validator.hs`
- [Type checker](https://github.com/elis3o2/dsl-prob/blob/main/src/TypeChecker.hs): `src/TypeChecker.hs`
- [Evaluation](https://github.com/elis3o2/dsl-prob/blob/main/src/Eval.hs): `src/Eval.hs`
- [Runtime support](https://github.com/elis3o2/dsl-prob/blob/main/src/Monad.hs): `src/Monad.hs`
- [Errors](https://github.com/elis3o2/dsl-prob/blob/main/src/Error.hs): `src/Error.hs`
- [Shared definitions](https://github.com/elis3o2/dsl-prob/blob/main/src/Common.hs): `src/Common.hs`
- [Global state](https://github.com/elis3o2/dsl-prob/blob/main/src/Global.hs): `src/Global.hs`

### Probability domain

- [Distributions](https://github.com/elis3o2/dsl-prob/blob/main/src/Distribution.hs): `src/Distribution.hs`
- [Binary operations](https://github.com/elis3o2/dsl-prob/blob/main/src/CBin.hs): `src/CBin.hs`

### Markov analysis

- [Markov chains](https://github.com/elis3o2/dsl-prob/blob/main/src/Markov.hs): `src/Markov.hs`
- [Matrix operations](https://github.com/elis3o2/dsl-prob/blob/main/src/Matrix.hs): `src/Matrix.hs`
- [Simulation](https://github.com/elis3o2/dsl-prob/blob/main/src/Simulation.hs): `src/Simulation.hs`

### Results and presentation

- [Probability tables](https://github.com/elis3o2/dsl-prob/blob/main/src/Table.hs): `src/Table.hs`
- [Plotting](https://github.com/elis3o2/dsl-prob/blob/main/src/Plot.hs): `src/Plot.hs`
- [Pretty printing](https://github.com/elis3o2/dsl-prob/blob/main/src/PPrint.hs): `src/PPrint.hs`

### Other components

- **Script / REPL user**
- **gnuplot**
- **Graphviz**

## Connections

- Script / REPL user → Interpreter: runs scripts / REPL (evidence: `README.md`)
- Plotting → gnuplot: plots distributions (evidence: `README.md`)
- Plotting → Graphviz: plots chains (evidence: `README.md`)
