# hylo-lang/hylo-new architecture

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

- Interactive diagram: https://gitdiagram.com/hylo-lang/hylo-new
- Repository: https://github.com/hylo-lang/hylo-new

## Overview

Hylo is a safe systems programming language with a Swift-based compiler. The main workflow is source input through the `hc` command and driver, into parsing and semantic analysis, then IR generation and LLVM-backed output; the repository also includes an interpreter and standard library. The graph reflects documented and indexed connections, but several compiler-stage calls are only partially excerpted, so uncertain links are left out or marked dashed.

Main entry points: [`Sources/Driver/Driver.swift`](https://github.com/hylo-lang/hylo-new/blob/main/Sources/Driver/Driver.swift) (Compilation driver), [`Sources/FrontEnd/Program.swift`](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Program.swift) (Program model), [`Sources/Interpreter/Interpreter.swift`](https://github.com/hylo-lang/hylo-new/blob/main/Sources/Interpreter/Interpreter.swift) (Interpreter), [`Sources/hc/CommandLine.swift`](https://github.com/hylo-lang/hylo-new/blob/main/Sources/hc/CommandLine.swift) (hc command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Compiler entry"]
  node_cli["hc command<br/>[CommandLine.swift]"]
  node_driver["Compilation driver<br/>[Driver.swift]"]
end

subgraph group_frontend["Front end"]
  node_sources["Source files<br/>[SourceFile.swift]"]
  node_parser["Parser<br/>[Parser.swift]"]
  node_module["Module model<br/>[Module.swift]"]
  node_program["Program model<br/>[Program.swift]"]
  node_scoper["Scope assignment<br/>[Scoper.swift]"]
  node_typer["Type checker<br/>[Typer.swift]"]
  node_diagnostics["Diagnostics<br/>[Diagnostic.swift]"]
  node_ir["Hylo IR<br/>[IRFunction.swift]"]
end

subgraph group_execution["Execution"]
  node_interpreter["Interpreter<br/>[Interpreter.swift]"]
  node_memory["Runtime memory<br/>[Memory.swift]"]
end

subgraph group_output["Code generation"]
  node_backend["LLVM backend"]
  node_llvm["LLVM toolchain"]
  node_linker["clang linker"]
end

subgraph group_library["Language library"]
  node_stdlib["Standard library"]
  node_shim["C shims<br/>[shims.c]"]
end

node_user(("Compiler user"))

node_user -->|"invokes"| node_cli
node_cli -->|"configures"| node_driver
node_driver -->|"loads"| node_sources
node_driver -.->|"parses"| node_parser
node_parser -->|"inserts syntax"| node_module
node_driver -->|"adds sources"| node_module
node_driver -->|"assigns scopes"| node_program
node_program -->|"uses"| node_scoper
node_program -->|"uses"| node_typer
node_driver -->|"checks errors"| node_diagnostics
node_program -->|"emits"| node_ir
node_interpreter -->|"executes"| node_program
node_interpreter -->|"uses"| node_memory
node_driver -.->|"generates code"| node_backend
node_backend -.->|"emits LLVM"| node_llvm
node_driver -->|"links with clang"| node_linker
node_driver -->|"loads library"| node_stdlib
node_driver -->|"compiles shim"| node_shim

click node_cli "https://github.com/hylo-lang/hylo-new/blob/main/Sources/hc/CommandLine.swift"
click node_driver "https://github.com/hylo-lang/hylo-new/blob/main/Sources/Driver/Driver.swift"
click node_sources "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Files/SourceFile.swift"
click node_parser "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Parser/Parser.swift"
click node_module "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Module.swift"
click node_program "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Program.swift"
click node_scoper "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Scoper.swift"
click node_typer "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Typer/Typer.swift"
click node_diagnostics "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Diagnostic.swift"
click node_ir "https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/IR/IRFunction.swift"
click node_interpreter "https://github.com/hylo-lang/hylo-new/blob/main/Sources/Interpreter/Interpreter.swift"
click node_memory "https://github.com/hylo-lang/hylo-new/blob/main/Sources/Interpreter/Memory.swift"
click node_backend "https://github.com/hylo-lang/hylo-new/blob/main/Sources/BackEnd/FunctionGenerationContext.swift"
click node_stdlib "https://github.com/hylo-lang/hylo-new/blob/main/StandardLibrary/StandardLibrary.swift"
click node_shim "https://github.com/hylo-lang/hylo-new/blob/main/StandardLibrary/Sources/shims.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_cli,node_driver,node_user toneBlue
class node_sources,node_parser,node_module,node_program,node_scoper,node_typer,node_diagnostics,node_ir toneAmber
class node_interpreter,node_memory toneMint
class node_backend,node_llvm,node_linker toneRose
class node_stdlib,node_shim toneIndigo
```

## Components

### Compiler entry

- [hc command](https://github.com/hylo-lang/hylo-new/blob/main/Sources/hc/CommandLine.swift): `Sources/hc/CommandLine.swift`
- [Compilation driver](https://github.com/hylo-lang/hylo-new/blob/main/Sources/Driver/Driver.swift): `Sources/Driver/Driver.swift`

### Front end

- [Source files](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Files/SourceFile.swift): `Sources/FrontEnd/Files/SourceFile.swift`
- [Parser](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Parser/Parser.swift): `Sources/FrontEnd/Parser/Parser.swift`
- [Module model](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Module.swift): `Sources/FrontEnd/Module.swift`
- [Program model](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Program.swift): `Sources/FrontEnd/Program.swift`
- [Scope assignment](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Scoper.swift): `Sources/FrontEnd/Scoper.swift`
- [Type checker](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Typer/Typer.swift): `Sources/FrontEnd/Typer/Typer.swift`
- [Diagnostics](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/Diagnostic.swift): `Sources/FrontEnd/Diagnostic.swift`
- [Hylo IR](https://github.com/hylo-lang/hylo-new/blob/main/Sources/FrontEnd/IR/IRFunction.swift): `Sources/FrontEnd/IR/IRFunction.swift`

### Execution

- [Interpreter](https://github.com/hylo-lang/hylo-new/blob/main/Sources/Interpreter/Interpreter.swift): `Sources/Interpreter/Interpreter.swift`
- [Runtime memory](https://github.com/hylo-lang/hylo-new/blob/main/Sources/Interpreter/Memory.swift): `Sources/Interpreter/Memory.swift`

### Code generation

- [LLVM backend](https://github.com/hylo-lang/hylo-new/blob/main/Sources/BackEnd/FunctionGenerationContext.swift): `Sources/BackEnd/FunctionGenerationContext.swift`
- **LLVM toolchain**
- **clang linker**

### Language library

- [Standard library](https://github.com/hylo-lang/hylo-new/blob/main/StandardLibrary/StandardLibrary.swift): `StandardLibrary/StandardLibrary.swift`
- [C shims](https://github.com/hylo-lang/hylo-new/blob/main/StandardLibrary/Sources/shims.c): `StandardLibrary/Sources/shims.c`

### Other components

- **Compiler user**

## Connections

- Compiler user → hc command: invokes (evidence: `Sources/hc/CommandLine.swift`)
- hc command → Compilation driver: configures (evidence: `Sources/hc/CommandLine.swift`)
- Compilation driver → Source files: loads (evidence: `Sources/Driver/Driver.swift`)
- Compilation driver → Parser: parses
- Parser → Module model: inserts syntax (evidence: `Sources/FrontEnd/Parser/Parser.swift`)
- Compilation driver → Module model: adds sources (evidence: `Sources/Driver/Driver.swift`)
- Compilation driver → Program model: assigns scopes (evidence: `Sources/Driver/Driver.swift`)
- Program model → Scope assignment: uses (evidence: `Sources/FrontEnd/Program.swift`)
- Program model → Type checker: uses (evidence: `Sources/FrontEnd/Program.swift`)
- Compilation driver → Diagnostics: checks errors (evidence: `Sources/Driver/Driver.swift`)
- Program model → Hylo IR: emits (evidence: `Sources/FrontEnd/Program.swift`)
- Interpreter → Program model: executes (evidence: `Sources/Interpreter/Interpreter.swift`)
- Interpreter → Runtime memory: uses (evidence: `Sources/Interpreter/Interpreter.swift`)
- Compilation driver → LLVM backend: generates code
- LLVM backend → LLVM toolchain: emits LLVM
- Compilation driver → clang linker: links with clang (evidence: `README.md`)
- Compilation driver → Standard library: loads library (evidence: `Sources/Driver/Driver.swift`)
- Compilation driver → C shims: compiles shim (evidence: `Sources/Driver/Driver.swift`)
