# nrnrnr/qc-- architecture

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

- Interactive diagram: https://gitdiagram.com/nrnrnr/qc--
- Repository: https://github.com/nrnrnr/qc--

## Overview

Quick C-- is a retired compiler toolchain: its README describes a workflow in which a compiler emits C-- and Quick C-- turns it into efficient machine code. The supplied tree is centered on interpreter/encoding code and runtime support, rather than exposing a complete compiler front end. The graph therefore shows the documented product boundary and the identifiable interpreter components; internal runtime links are limited to relationships supported by the excerpts or source index.

Main entry points: [`interp/interp-dec.c`](https://github.com/nrnrnr/qc--/blob/master/interp/interp-dec.c) (C-- interpreter), [`interp/encode.c`](https://github.com/nrnrnr/qc--/blob/master/interp/encode.c) (Instruction encoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["C-- interface"]
  node_cmm_input["C-- input"]
  node_machine_code["Machine code"]
end

subgraph group_engine["Interpreter engine"]
  node_decoder["C-- interpreter<br/>[interp-dec.c]"]
  node_encoder["Instruction encoder<br/>[encode.c]"]
  node_disassembler["Instruction disassembler<br/>[disasm-dec.c]"]
  node_machine_lib["Machine-code library<br/>[mclib.c]"]
end

subgraph group_support["Runtime support"]
  node_memory["Memory management<br/>[mem.c]"]
  node_arena["Arena allocation<br/>[arena.c]"]
  node_atoms["Atom handling<br/>[atom.c]"]
  node_formatting["Formatting<br/>[fmt.c]"]
  node_exceptions["Exception handling<br/>[except.c]"]
  node_multiprecision["Multiprecision arithmetic<br/>[mp.c]"]
  node_extended_precision["Extended precision<br/>[xp.c]"]
  node_trace["Runtime tracing<br/>[trace.c]"]
  node_overflow["Overflow support"]
end

node_compiler_author(("C-- compiler author"))

node_compiler_author -->|"emits C--"| node_cmm_input
node_cmm_input -.->|"provides input"| node_decoder
node_decoder -->|"produces code"| node_machine_code
node_decoder -->|"uses definitions"| node_encoder

click node_decoder "https://github.com/nrnrnr/qc--/blob/master/interp/interp-dec.c"
click node_encoder "https://github.com/nrnrnr/qc--/blob/master/interp/encode.c"
click node_disassembler "https://github.com/nrnrnr/qc--/blob/master/interp/disasm-dec.c"
click node_machine_lib "https://github.com/nrnrnr/qc--/blob/master/interp/mclib.c"
click node_memory "https://github.com/nrnrnr/qc--/blob/master/interp/mem.c"
click node_arena "https://github.com/nrnrnr/qc--/blob/master/interp/arena.c"
click node_atoms "https://github.com/nrnrnr/qc--/blob/master/interp/atom.c"
click node_formatting "https://github.com/nrnrnr/qc--/blob/master/interp/fmt.c"
click node_exceptions "https://github.com/nrnrnr/qc--/blob/master/interp/except.c"
click node_multiprecision "https://github.com/nrnrnr/qc--/blob/master/interp/mp.c"
click node_extended_precision "https://github.com/nrnrnr/qc--/blob/master/interp/xp.c"
click node_trace "https://github.com/nrnrnr/qc--/blob/master/runtime/trace.c"
click node_overflow "https://github.com/nrnrnr/qc--/blob/master/runtime/overflow/directreturn/runtime-internals.c"

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_cmm_input,node_machine_code toneBlue
class node_decoder,node_encoder,node_disassembler,node_machine_lib toneAmber
class node_memory,node_arena,node_atoms,node_formatting,node_exceptions,node_multiprecision,node_extended_precision,node_trace,node_overflow toneMint
class node_compiler_author toneIndigo
```

## Components

### C-- interface

- **C-- input**
- **Machine code**

### Interpreter engine

- [C-- interpreter](https://github.com/nrnrnr/qc--/blob/master/interp/interp-dec.c): `interp/interp-dec.c`
- [Instruction encoder](https://github.com/nrnrnr/qc--/blob/master/interp/encode.c): `interp/encode.c`
- [Instruction disassembler](https://github.com/nrnrnr/qc--/blob/master/interp/disasm-dec.c): `interp/disasm-dec.c`
- [Machine-code library](https://github.com/nrnrnr/qc--/blob/master/interp/mclib.c): `interp/mclib.c`

### Runtime support

- [Memory management](https://github.com/nrnrnr/qc--/blob/master/interp/mem.c): `interp/mem.c`
- [Arena allocation](https://github.com/nrnrnr/qc--/blob/master/interp/arena.c): `interp/arena.c`
- [Atom handling](https://github.com/nrnrnr/qc--/blob/master/interp/atom.c): `interp/atom.c`
- [Formatting](https://github.com/nrnrnr/qc--/blob/master/interp/fmt.c): `interp/fmt.c`
- [Exception handling](https://github.com/nrnrnr/qc--/blob/master/interp/except.c): `interp/except.c`
- [Multiprecision arithmetic](https://github.com/nrnrnr/qc--/blob/master/interp/mp.c): `interp/mp.c`
- [Extended precision](https://github.com/nrnrnr/qc--/blob/master/interp/xp.c): `interp/xp.c`
- [Runtime tracing](https://github.com/nrnrnr/qc--/blob/master/runtime/trace.c): `runtime/trace.c`
- [Overflow support](https://github.com/nrnrnr/qc--/blob/master/runtime/overflow/directreturn/runtime-internals.c): `runtime/overflow/directreturn/runtime-internals.c`

### Other components

- **C-- compiler author**

## Connections

- C-- compiler author → C-- input: emits C-- (evidence: `README`)
- C-- input → C-- interpreter: provides input
- C-- interpreter → Machine code: produces code (evidence: `README`)
- C-- interpreter → Instruction encoder: uses definitions (evidence: `interp/interp-dec.c`)
