# londopy/nexium architecture

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

- Interactive diagram: https://gitdiagram.com/londopy/nexium
- Repository: https://github.com/londopy/nexium
- Video tour (about a minute): https://gitdiagram.com/londopy/nexium/video

## Overview

Nexium is a self-hosted programming language and toolchain. A user writes a `.nx` program and invokes `nx`; the compiler parses and checks it, emits C, and uses a C compiler to produce native output. The `nx ship` workflow packages one source tree into supported library and application artifacts. The README also documents the standard library, editor/LSP tooling, browser playground, and GUI. Compiler internals are largely unsampled, so internal-stage links are omitted rather than inferred; documented product flows are retained.

Main entry points: [`self/nx.nx`](https://github.com/londopy/nexium/blob/main/self/nx.nx) (nx CLI), [`self/lexer.nx`](https://github.com/londopy/nexium/blob/main/self/lexer.nx) (Lexer), [`self/parser.nx`](https://github.com/londopy/nexium/blob/main/self/parser.nx) (Parser), [`self/check.nx`](https://github.com/londopy/nexium/blob/main/self/check.nx) (Semantic checker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_compiler["Compiler"]
  node_nx["nx CLI<br/>[nx.nx]"]
  node_lexer["Lexer<br/>[lexer.nx]"]
  node_parser["Parser<br/>[parser.nx]"]
  node_checker["Semantic checker<br/>[check.nx]"]
  node_codegen["C codegen<br/>[cgen.nx]"]
  node_ccompiler["C compiler"]
end

subgraph group_runtime["Runtime and libraries"]
  node_nxruntime["Nexium runtime<br/>[nx_rt.h]"]
  node_stdlib["Standard library"]
end

subgraph group_delivery["Tools and targets"]
  node_program["Native program"]
  node_ship["Artifact shipping<br/>[ship.nx]"]
  node_artifacts["C, Python, Rust, npm, WASM"]
  node_tooling["Developer tools<br/>[tools.nx]"]
end

subgraph group_interfaces["User interfaces"]
  node_lsp["Language server<br/>[lsp.nx]"]
  node_editor["Editor integrations"]
  node_playground["Browser playground<br/>[play.js]"]
  node_gui["Immediate-mode GUI<br/>[nexium_gui.nx]"]
end

node_developer(("Developer"))

node_developer -->|"invokes"| node_nx
node_nx -.->|"processes source"| node_lexer
node_lexer -.->|"tokens"| node_parser
node_parser -.->|"syntax tree"| node_checker
node_checker -.->|"checked program"| node_codegen
node_codegen -->|"emits C for"| node_ccompiler
node_ccompiler -->|"compiles"| node_program
node_program -.->|"uses"| node_nxruntime
node_program -.->|"uses"| node_stdlib
node_developer -->|"ships source"| node_ship
node_ship -->|"produces"| node_artifacts
node_developer -->|"runs tools"| node_tooling
node_editor -->|"starts"| node_lsp
node_developer -->|"runs exercises"| node_playground
node_playground -->|"runs compiler"| node_nx
node_developer -->|"builds GUI apps"| node_gui

click node_nx "https://github.com/londopy/nexium/blob/main/self/nx.nx"
click node_lexer "https://github.com/londopy/nexium/blob/main/self/lexer.nx"
click node_parser "https://github.com/londopy/nexium/blob/main/self/parser.nx"
click node_checker "https://github.com/londopy/nexium/blob/main/self/check.nx"
click node_codegen "https://github.com/londopy/nexium/blob/main/self/cgen.nx"
click node_nxruntime "https://github.com/londopy/nexium/blob/main/runtime/nx_rt.h"
click node_stdlib "https://github.com/londopy/nexium/tree/main/std"
click node_ship "https://github.com/londopy/nexium/blob/main/self/ship.nx"
click node_tooling "https://github.com/londopy/nexium/blob/main/self/tools.nx"
click node_lsp "https://github.com/londopy/nexium/blob/main/self/lsp.nx"
click node_editor "https://github.com/londopy/nexium/tree/main/editors"
click node_playground "https://github.com/londopy/nexium/blob/main/site/play.js"
click node_gui "https://github.com/londopy/nexium/blob/main/gui/nexium_gui.nx"

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_nx,node_lexer,node_parser,node_checker,node_codegen,node_ccompiler toneBlue
class node_nxruntime,node_stdlib toneAmber
class node_program,node_ship,node_artifacts,node_tooling toneMint
class node_lsp,node_editor,node_playground,node_gui toneRose
class node_developer toneIndigo
```

## Components

### Compiler

- [nx CLI](https://github.com/londopy/nexium/blob/main/self/nx.nx): `self/nx.nx`
- [Lexer](https://github.com/londopy/nexium/blob/main/self/lexer.nx): `self/lexer.nx`
- [Parser](https://github.com/londopy/nexium/blob/main/self/parser.nx): `self/parser.nx`
- [Semantic checker](https://github.com/londopy/nexium/blob/main/self/check.nx): `self/check.nx`
- [C codegen](https://github.com/londopy/nexium/blob/main/self/cgen.nx): `self/cgen.nx`
- **C compiler**

### Runtime and libraries

- [Nexium runtime](https://github.com/londopy/nexium/blob/main/runtime/nx_rt.h): `runtime/nx_rt.h`
- [Standard library](https://github.com/londopy/nexium/tree/main/std): `std`

### Tools and targets

- **Native program**
- [Artifact shipping](https://github.com/londopy/nexium/blob/main/self/ship.nx): `self/ship.nx`
- **C, Python, Rust, npm, WASM**
- [Developer tools](https://github.com/londopy/nexium/blob/main/self/tools.nx): `self/tools.nx`

### User interfaces

- [Language server](https://github.com/londopy/nexium/blob/main/self/lsp.nx): `self/lsp.nx`
- [Editor integrations](https://github.com/londopy/nexium/tree/main/editors): `editors`
- [Browser playground](https://github.com/londopy/nexium/blob/main/site/play.js): `site/play.js`
- [Immediate-mode GUI](https://github.com/londopy/nexium/blob/main/gui/nexium_gui.nx): `gui/nexium_gui.nx`

### Other components

- **Developer**

## Connections

- Developer → nx CLI: invokes (evidence: `README.md`)
- nx CLI → Lexer: processes source
- Lexer → Parser: tokens
- Parser → Semantic checker: syntax tree
- Semantic checker → C codegen: checked program
- C codegen → C compiler: emits C for (evidence: `README.md`)
- C compiler → Native program: compiles (evidence: `README.md`)
- Native program → Nexium runtime: uses
- Native program → Standard library: uses
- Developer → Artifact shipping: ships source (evidence: `README.md`)
- Artifact shipping → C, Python, Rust, npm, WASM: produces (evidence: `README.md`)
- Developer → Developer tools: runs tools (evidence: `README.md`)
- Editor integrations → Language server: starts (evidence: `editors/vscode/package.json`)
- Developer → Browser playground: runs exercises (evidence: `site/play.js`)
- Browser playground → nx CLI: runs compiler (evidence: `site/play.js`)
- Developer → Immediate-mode GUI: builds GUI apps (evidence: `README.md`)
