# elhamdolillah/ilm-al-kitab architecture

> Architecture diagram of the GitHub repository elhamdolillah/ilm-al-kitab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elhamdolillah/ilm-al-kitab
- Repository: https://github.com/elhamdolillah/ilm-al-kitab

## Overview

MAL is an Arabic-oriented programming language with compiler front ends and native code-generation paths. The main documented workflow is a user invoking `malc` to check, compile, or run a source file; a separate `malc-native` tool lowers input to NIR and compiles native output. The tree also contains mathematical and language-feature libraries. The README is empty, and excerpts are partial, so several subsystem connections are intentionally left unspecified.

Main entry points: [`MAL/src/cli/src/main.rs`](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/cli/src/main.rs) (malc CLI), [`MAL/tools/malc-native/src/main.rs`](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/tools/malc-native/src/main.rs) (malc-native), [`server.py`](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/server.py) (Flask server), [`MAL/src/native/src/lib.rs`](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/native/src/lib.rs) (Native codegen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Compiler interfaces"]
  node_malc["malc CLI<br/>[main.rs]"]
  node_server["Flask server<br/>[server.py]"]
  node_native_tool["malc-native<br/>[main.rs]"]
end

subgraph group_pipeline["Compilation pipeline"]
  node_lexer["Lexer<br/>[lib.rs]"]
  node_parser["Parser<br/>[lib.rs]"]
  node_arena["AST arena<br/>[lib.rs]"]
  node_typecheck["Type inference<br/>[type_inference.rs]"]
  node_nir["NIR lowering<br/>[lowering.rs]"]
  node_backend["C backend<br/>[lib.rs]"]
  node_native["Native codegen<br/>[lib.rs]"]
end

subgraph group_math["Mathematical libraries"]
  node_proof["Proof search<br/>[lib.rs]"]
  node_model["Model theory<br/>[lib.rs]"]
  node_set["Set theory<br/>[lib.rs]"]
  node_category["Category theory<br/>[lib.rs]"]
end

subgraph group_language["Language features"]
  node_abjad["Abjad types<br/>[lib.rs]"]
  node_kb["Knowledge base<br/>[lib.rs]"]
  node_session["Sessions<br/>[lib.rs]"]
end

node_user(("Program author"))
node_source["MAL source"]
node_binary["Native binary"]

node_user -->|"invokes"| node_malc
node_malc -->|"reads"| node_source
node_malc -->|"transpiles"| node_backend
node_malc -->|"writes"| node_binary
node_native_tool -->|"reads"| node_source
node_native_tool -->|"allocates"| node_arena
node_native_tool -->|"lowers AST"| node_nir
node_native_tool -->|"compiles NIR"| node_native
node_native -->|"emits ELF"| node_binary
node_server -.->|"runs compiler"| node_malc
node_server -.->|"executes"| node_binary

click node_malc "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/cli/src/main.rs"
click node_server "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/server.py"
click node_lexer "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/lexer/src/lib.rs"
click node_parser "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/parser/src/lib.rs"
click node_arena "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/arena/src/lib.rs"
click node_typecheck "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/nir/src/type_inference.rs"
click node_nir "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/nir/src/lowering.rs"
click node_backend "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/backend/src/lib.rs"
click node_native_tool "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/tools/malc-native/src/main.rs"
click node_native "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/native/src/lib.rs"
click node_proof "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/search/src/lib.rs"
click node_model "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/model/src/lib.rs"
click node_set "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/set/src/lib.rs"
click node_category "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/category/src/lib.rs"
click node_abjad "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/abjad/src/lib.rs"
click node_kb "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/kb/src/lib.rs"
click node_session "https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/session/src/lib.rs"

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_malc,node_server,node_native_tool toneBlue
class node_lexer,node_parser,node_arena,node_typecheck,node_nir,node_backend,node_native toneAmber
class node_proof,node_model,node_set,node_category toneMint
class node_abjad,node_kb,node_session toneRose
class node_user,node_source,node_binary toneIndigo
```

## Components

### Compiler interfaces

- [malc CLI](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/cli/src/main.rs): `MAL/src/cli/src/main.rs`
- [Flask server](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/server.py): `server.py`
- [malc-native](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/tools/malc-native/src/main.rs): `MAL/tools/malc-native/src/main.rs`

### Compilation pipeline

- [Lexer](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/lexer/src/lib.rs): `MAL/src/lexer/src/lib.rs`
- [Parser](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/parser/src/lib.rs): `MAL/src/parser/src/lib.rs`
- [AST arena](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/arena/src/lib.rs): `MAL/src/arena/src/lib.rs`
- [Type inference](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/nir/src/type_inference.rs): `MAL/src/nir/src/type_inference.rs`
- [NIR lowering](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/nir/src/lowering.rs): `MAL/src/nir/src/lowering.rs`
- [C backend](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/backend/src/lib.rs): `MAL/src/backend/src/lib.rs`
- [Native codegen](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/native/src/lib.rs): `MAL/src/native/src/lib.rs`

### Mathematical libraries

- [Proof search](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/search/src/lib.rs): `MAL/src/search/src/lib.rs`
- [Model theory](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/model/src/lib.rs): `MAL/src/model/src/lib.rs`
- [Set theory](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/set/src/lib.rs): `MAL/src/set/src/lib.rs`
- [Category theory](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/category/src/lib.rs): `MAL/src/category/src/lib.rs`

### Language features

- [Abjad types](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/abjad/src/lib.rs): `MAL/src/abjad/src/lib.rs`
- [Knowledge base](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/kb/src/lib.rs): `MAL/src/kb/src/lib.rs`
- [Sessions](https://github.com/elhamdolillah/ilm-al-kitab/blob/main/MAL/src/session/src/lib.rs): `MAL/src/session/src/lib.rs`

### Other components

- **Program author**
- **MAL source**
- **Native binary**

## Connections

- Program author → malc CLI: invokes
- malc CLI → MAL source: reads
- malc CLI → C backend: transpiles
- malc CLI → Native binary: writes
- malc-native → MAL source: reads
- malc-native → AST arena: allocates
- malc-native → NIR lowering: lowers AST
- malc-native → Native codegen: compiles NIR
- Native codegen → Native binary: emits ELF
- Flask server → malc CLI: runs compiler
- Flask server → Native binary: executes
