# blanketsucks/language architecture

> Architecture diagram of the GitHub repository blanketsucks/language, 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/blanketsucks/language
- Repository: https://github.com/blanketsucks/language

## Overview

Quart is a small experimental programming language compiler. A user supplies source files and compiler options; the CLI constructs compiler options and invokes compilation, which produces an executable or another requested format. The graph preserves the documented LLVM IR/bitcode, assembly, object, executable and shared-library outputs, plus optimization and the x86-64 backend visible in the tree. Source excerpts establish the CLI handoff and parts of parsing and bytecode generation; several internal stage connections are therefore dashed and unverified.

Main entry points: [`quart/compiler.cpp`](https://github.com/blanketsucks/language/blob/master/quart/compiler.cpp) (Compiler), [`quart/bytecode/ast.cpp`](https://github.com/blanketsucks/language/blob/master/quart/bytecode/ast.cpp) (AST Bytecode Generation), [`quart/cl.cpp`](https://github.com/blanketsucks/language/blob/master/quart/cl.cpp) (CLI Arguments), [`quart/filesystem.cpp`](https://github.com/blanketsucks/language/blob/master/quart/filesystem.cpp) (Source Files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation"]
  node_cli["CLI Arguments<br/>[cl.cpp]"]
  node_compiler["Compiler<br/>[compiler.cpp]"]
end

subgraph group_front["Source Front End"]
  node_files["Source Files<br/>[filesystem.cpp]"]
  node_lexer["Lexer<br/>[lexer.cpp]"]
  node_tokens["Tokens<br/>[tokens.h]"]
  node_parser["Parser<br/>[parser.cpp]"]
  node_syntax["Syntax AST<br/>[ast.h]"]
end

subgraph group_semantics["Language Semantics"]
  node_state["Compilation State<br/>[state.cpp]"]
  node_typecheck["Type Checking<br/>[type_checker.cpp]"]
  node_constants["Constant Evaluation<br/>[consteval.cpp]"]
end

subgraph group_ir["Bytecode"]
  node_lowering["AST Bytecode Generation<br/>[ast.cpp]"]
  node_bytecode["Bytecode Instructions<br/>[instruction.cpp]"]
  node_optimization["Optimization Passes"]
end

subgraph group_backends["Code Generation"]
  node_llvm["LLVM Backend<br/>[codegen.cpp]"]
  node_x86["x86-64 Backend<br/>[codegen.cpp]"]
  node_output["Compiler Output"]
end

node_user(("Compiler User"))

node_user -->|"provides options"| node_cli
node_cli -->|"configures and invokes"| node_compiler
node_compiler -.->|"loads source"| node_files
node_files -.->|"supplies source"| node_lexer
node_lexer -.->|"produces"| node_tokens
node_tokens -->|"consumed by"| node_parser
node_parser -.->|"builds"| node_syntax
node_syntax -.->|"lowered by"| node_lowering
node_lowering -->|"emits through"| node_state
node_lowering -->|"evaluates constants with"| node_constants
node_state -.->|"uses semantic checks"| node_typecheck
node_lowering -.->|"emits instructions"| node_bytecode
node_bytecode -.->|"optimized by"| node_optimization
node_compiler -.->|"selects backend"| node_llvm
node_compiler -.->|"selects backend"| node_x86
node_llvm -.->|"emits requested format"| node_output
node_x86 -.->|"emits assembly"| node_output

click node_cli "https://github.com/blanketsucks/language/blob/master/quart/cl.cpp"
click node_compiler "https://github.com/blanketsucks/language/blob/master/quart/compiler.cpp"
click node_files "https://github.com/blanketsucks/language/blob/master/quart/filesystem.cpp"
click node_lexer "https://github.com/blanketsucks/language/blob/master/quart/lexer/lexer.cpp"
click node_tokens "https://github.com/blanketsucks/language/blob/master/quart/lexer/tokens.h"
click node_parser "https://github.com/blanketsucks/language/blob/master/quart/parser/parser.cpp"
click node_syntax "https://github.com/blanketsucks/language/blob/master/quart/parser/ast.h"
click node_lowering "https://github.com/blanketsucks/language/blob/master/quart/bytecode/ast.cpp"
click node_state "https://github.com/blanketsucks/language/blob/master/quart/language/state.cpp"
click node_typecheck "https://github.com/blanketsucks/language/blob/master/quart/language/type_checker.cpp"
click node_constants "https://github.com/blanketsucks/language/blob/master/quart/language/consteval.cpp"
click node_bytecode "https://github.com/blanketsucks/language/blob/master/quart/bytecode/instruction.cpp"
click node_optimization "https://github.com/blanketsucks/language/blob/master/quart/bytecode/passes/eliminate_unreachable_blocks.cpp"
click node_llvm "https://github.com/blanketsucks/language/blob/master/quart/codegen/llvm/codegen.cpp"
click node_x86 "https://github.com/blanketsucks/language/blob/master/quart/codegen/x86_64/codegen.cpp"

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_compiler,node_user toneBlue
class node_files,node_lexer,node_tokens,node_parser,node_syntax toneAmber
class node_state,node_typecheck,node_constants toneMint
class node_lowering,node_bytecode,node_optimization toneRose
class node_llvm,node_x86,node_output toneIndigo
```

## Components

### Invocation

- [CLI Arguments](https://github.com/blanketsucks/language/blob/master/quart/cl.cpp): `quart/cl.cpp`
- [Compiler](https://github.com/blanketsucks/language/blob/master/quart/compiler.cpp): `quart/compiler.cpp`

### Source Front End

- [Source Files](https://github.com/blanketsucks/language/blob/master/quart/filesystem.cpp): `quart/filesystem.cpp`
- [Lexer](https://github.com/blanketsucks/language/blob/master/quart/lexer/lexer.cpp): `quart/lexer/lexer.cpp`
- [Tokens](https://github.com/blanketsucks/language/blob/master/quart/lexer/tokens.h): `quart/lexer/tokens.h`
- [Parser](https://github.com/blanketsucks/language/blob/master/quart/parser/parser.cpp): `quart/parser/parser.cpp`
- [Syntax AST](https://github.com/blanketsucks/language/blob/master/quart/parser/ast.h): `quart/parser/ast.h`

### Language Semantics

- [Compilation State](https://github.com/blanketsucks/language/blob/master/quart/language/state.cpp): `quart/language/state.cpp`
- [Type Checking](https://github.com/blanketsucks/language/blob/master/quart/language/type_checker.cpp): `quart/language/type_checker.cpp`
- [Constant Evaluation](https://github.com/blanketsucks/language/blob/master/quart/language/consteval.cpp): `quart/language/consteval.cpp`

### Bytecode

- [AST Bytecode Generation](https://github.com/blanketsucks/language/blob/master/quart/bytecode/ast.cpp): `quart/bytecode/ast.cpp`
- [Bytecode Instructions](https://github.com/blanketsucks/language/blob/master/quart/bytecode/instruction.cpp): `quart/bytecode/instruction.cpp`
- [Optimization Passes](https://github.com/blanketsucks/language/blob/master/quart/bytecode/passes/eliminate_unreachable_blocks.cpp): `quart/bytecode/passes/eliminate_unreachable_blocks.cpp`

### Code Generation

- [LLVM Backend](https://github.com/blanketsucks/language/blob/master/quart/codegen/llvm/codegen.cpp): `quart/codegen/llvm/codegen.cpp`
- [x86-64 Backend](https://github.com/blanketsucks/language/blob/master/quart/codegen/x86_64/codegen.cpp): `quart/codegen/x86_64/codegen.cpp`
- **Compiler Output**

### Other components

- **Compiler User**

## Connections

- Compiler User → CLI Arguments: provides options
- CLI Arguments → Compiler: configures and invokes
- Compiler → Source Files: loads source
- Source Files → Lexer: supplies source
- Lexer → Tokens: produces
- Tokens → Parser: consumed by
- Parser → Syntax AST: builds
- Syntax AST → AST Bytecode Generation: lowered by
- AST Bytecode Generation → Compilation State: emits through (evidence: `quart/bytecode/ast.cpp`)
- AST Bytecode Generation → Constant Evaluation: evaluates constants with (evidence: `quart/bytecode/ast.cpp`)
- Compilation State → Type Checking: uses semantic checks
- AST Bytecode Generation → Bytecode Instructions: emits instructions
- Bytecode Instructions → Optimization Passes: optimized by
- Compiler → LLVM Backend: selects backend
- Compiler → x86-64 Backend: selects backend
- LLVM Backend → Compiler Output: emits requested format
- x86-64 Backend → Compiler Output: emits assembly
