# onurgumus/zero-csharp architecture

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

- Interactive diagram: https://gitdiagram.com/onurgumus/zero-csharp
- Repository: https://github.com/onurgumus/zero-csharp

## Overview

Zero C# is a small-runtime C# platform for producing native programs across desktop, web, firmware, and constrained hardware targets. The principal workflow is to start a project from a template, compile C# against the zero-mode libraries and runtime, and run the resulting program on a supported target. The repository also includes source generators, a bitcode conversion tool, and substantial library capabilities such as I/O, collections, text, time, and concurrency. Edges are limited to README statements and relationships visible in indexed excerpts; unsampled target and library internals are not inferred.

Main entry points: [`sdk/ZeroCSharp.Generate/Program.cs`](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Generate/Program.cs) (Source generators), [`zerocore/Runtime/Unsafe.cs`](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Unsafe.cs) (Memory intrinsics), [`sdk/ZeroCSharp.Templates/content/zero/Program.cs`](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Templates/content/zero/Program.cs) (Project templates), [`zerocore/Runtime/Startup.cs`](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Startup.cs) (Runtime startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Project authoring"]
  node_templates["Project templates<br/>[Program.cs]"]
end

subgraph group_compiler["Compilation tools"]
  node_sourcegen["Source generators<br/>[Program.cs]"]
  node_jsongen["JSON generator<br/>[JsonGenerator.cs]"]
  node_xmlgen["XML generator<br/>[XmlGenerator.cs]"]
  node_bitcode["Bitcode converter<br/>[Program.cs]"]
end

subgraph group_runtime["Zero runtime"]
  node_startup["Runtime startup<br/>[Startup.cs]"]
  node_exports["Runtime exports<br/>[RuntimeExports.cs]"]
  node_unsafe["Memory intrinsics<br/>[Unsafe.cs]"]
  node_environment["Environment<br/>[Environment.cs]"]
end

subgraph group_library["Core libraries"]
  node_arrays["Arrays and spans<br/>[Array.cs]"]
  node_span["Span operations<br/>[Span.cs]"]
  node_collections["Dictionary<br/>[Dictionary.cs]"]
  node_conversion["Conversions<br/>[Convert.cs]"]
  node_datetime["Date and time<br/>[DateTime.cs]"]
  node_decimal["Decimal arithmetic<br/>[Decimal.cs]"]
  node_math["Math<br/>[Math.cs]"]
  node_strings["String builder<br/>[StringBuilder.cs]"]
  node_threading["Threading primitives<br/>[Threading.cs]"]
  node_console["Console I/O<br/>[Console.cs]"]
  node_output["Output buffering<br/>[Out.cs]"]
  node_files["File access<br/>[File.cs]"]
  node_directories["Directory access<br/>[Directory.cs]"]
  node_async["Async tasks<br/>[Tasks.cs]"]
end

subgraph group_targets["Runtime targets"]
  node_platforms["Platform runtimes<br/>[rp2350.c]"]
  node_gpu["GPU kernels<br/>[cuda.c]"]
end

node_developer(("C&#35; developer"))
node_bflat["bflat compiler"]

node_developer -->|"starts project"| node_templates
node_templates -->|"builds with"| node_bflat
node_bflat -.->|"runs program"| node_startup
node_sourcegen -->|"runs generator"| node_jsongen
node_sourcegen -->|"runs generator"| node_xmlgen
node_developer -->|"generates code"| node_sourcegen
node_developer -->|"converts bitcode"| node_bitcode
node_startup -->|"uses exports"| node_exports
node_environment -->|"uses intrinsics"| node_unsafe
node_arrays -->|"uses intrinsics"| node_unsafe
node_span -->|"accesses array data"| node_arrays
node_strings -->|"uses spans"| node_span
node_threading -->|"uses intrinsics"| node_unsafe
node_console -->|"writes through"| node_output
node_async -->|"uses threading"| node_threading
node_platforms -->|"targeted by"| node_bflat
node_gpu -->|"kernels through"| node_bitcode

click node_templates "https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Templates/content/zero/Program.cs"
click node_sourcegen "https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Generate/Program.cs"
click node_jsongen "https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Json/JsonGenerator.cs"
click node_xmlgen "https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Xml/XmlGenerator.cs"
click node_bitcode "https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Bitcode/Program.cs"
click node_startup "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Startup.cs"
click node_exports "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/RuntimeExports.cs"
click node_unsafe "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Unsafe.cs"
click node_environment "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Environment.cs"
click node_arrays "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Array.cs"
click node_span "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Span.cs"
click node_collections "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Collections/Generic/Dictionary.cs"
click node_conversion "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Convert.cs"
click node_datetime "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/DateTime.cs"
click node_decimal "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Decimal.cs"
click node_math "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Math.cs"
click node_strings "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Text/StringBuilder.cs"
click node_threading "https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Threading.cs"
click node_console "https://github.com/onurgumus/zero-csharp/blob/master/lib/Console.cs"
click node_output "https://github.com/onurgumus/zero-csharp/blob/master/lib/Out.cs"
click node_files "https://github.com/onurgumus/zero-csharp/blob/master/lib/File.cs"
click node_directories "https://github.com/onurgumus/zero-csharp/blob/master/lib/Directory.cs"
click node_async "https://github.com/onurgumus/zero-csharp/blob/master/lib/Tasks.cs"
click node_platforms "https://github.com/onurgumus/zero-csharp/blob/master/arm/rp2350.c"
click node_gpu "https://github.com/onurgumus/zero-csharp/blob/master/gpu/cuda.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_templates toneBlue
class node_sourcegen,node_jsongen,node_xmlgen,node_bitcode toneAmber
class node_startup,node_exports,node_unsafe,node_environment toneMint
class node_arrays,node_span,node_collections,node_conversion,node_datetime,node_decimal,node_math,node_strings,node_threading,node_console,node_output,node_files,node_directories,node_async toneRose
class node_platforms,node_gpu,node_developer,node_bflat toneIndigo
```

## Components

### Project authoring

- [Project templates](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Templates/content/zero/Program.cs): `sdk/ZeroCSharp.Templates/content/zero/Program.cs`

### Compilation tools

- [Source generators](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Generate/Program.cs): `sdk/ZeroCSharp.Generate/Program.cs`
- [JSON generator](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Json/JsonGenerator.cs): `sdk/ZeroCSharp.Json/JsonGenerator.cs`
- [XML generator](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Xml/XmlGenerator.cs): `sdk/ZeroCSharp.Xml/XmlGenerator.cs`
- [Bitcode converter](https://github.com/onurgumus/zero-csharp/blob/master/sdk/ZeroCSharp.Bitcode/Program.cs): `sdk/ZeroCSharp.Bitcode/Program.cs`

### Zero runtime

- [Runtime startup](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Startup.cs): `zerocore/Runtime/Startup.cs`
- [Runtime exports](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/RuntimeExports.cs): `zerocore/Runtime/RuntimeExports.cs`
- [Memory intrinsics](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/Runtime/Unsafe.cs): `zerocore/Runtime/Unsafe.cs`
- [Environment](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Environment.cs): `zerocore/System/Environment.cs`

### Core libraries

- [Arrays and spans](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Array.cs): `zerocore/System/Array.cs`
- [Span operations](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Span.cs): `zerocore/System/Span.cs`
- [Dictionary](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Collections/Generic/Dictionary.cs): `zerocore/System/Collections/Generic/Dictionary.cs`
- [Conversions](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Convert.cs): `zerocore/System/Convert.cs`
- [Date and time](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/DateTime.cs): `zerocore/System/DateTime.cs`
- [Decimal arithmetic](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Decimal.cs): `zerocore/System/Decimal.cs`
- [Math](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Math.cs): `zerocore/System/Math.cs`
- [String builder](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Text/StringBuilder.cs): `zerocore/System/Text/StringBuilder.cs`
- [Threading primitives](https://github.com/onurgumus/zero-csharp/blob/master/zerocore/System/Threading.cs): `zerocore/System/Threading.cs`
- [Console I/O](https://github.com/onurgumus/zero-csharp/blob/master/lib/Console.cs): `lib/Console.cs`
- [Output buffering](https://github.com/onurgumus/zero-csharp/blob/master/lib/Out.cs): `lib/Out.cs`
- [File access](https://github.com/onurgumus/zero-csharp/blob/master/lib/File.cs): `lib/File.cs`
- [Directory access](https://github.com/onurgumus/zero-csharp/blob/master/lib/Directory.cs): `lib/Directory.cs`
- [Async tasks](https://github.com/onurgumus/zero-csharp/blob/master/lib/Tasks.cs): `lib/Tasks.cs`

### Runtime targets

- [Platform runtimes](https://github.com/onurgumus/zero-csharp/blob/master/arm/rp2350.c): `arm/rp2350.c`
- [GPU kernels](https://github.com/onurgumus/zero-csharp/blob/master/gpu/cuda.c): `gpu/cuda.c`

### Other components

- **C# developer**
- **bflat compiler**

## Connections

- C# developer → Project templates: starts project
- Project templates → bflat compiler: builds with
- bflat compiler → Runtime startup: runs program
- Source generators → JSON generator: runs generator (evidence: `sdk/ZeroCSharp.Generate/Program.cs`)
- Source generators → XML generator: runs generator (evidence: `sdk/ZeroCSharp.Generate/Program.cs`)
- C# developer → Source generators: generates code (evidence: `sdk/ZeroCSharp.Generate/Program.cs`)
- C# developer → Bitcode converter: converts bitcode (evidence: `sdk/ZeroCSharp.Bitcode/Program.cs`)
- Runtime startup → Runtime exports: uses exports (evidence: `zerocore/Runtime/Startup.cs`)
- Environment → Memory intrinsics: uses intrinsics (evidence: `zerocore/System/Environment.cs`)
- Arrays and spans → Memory intrinsics: uses intrinsics (evidence: `zerocore/System/Array.cs`)
- Span operations → Arrays and spans: accesses array data (evidence: `zerocore/System/Span.cs`)
- String builder → Span operations: uses spans (evidence: `zerocore/System/Text/StringBuilder.cs`)
- Threading primitives → Memory intrinsics: uses intrinsics (evidence: `zerocore/System/Threading.cs`)
- Console I/O → Output buffering: writes through (evidence: `lib/Console.cs`)
- Async tasks → Threading primitives: uses threading (evidence: `lib/Tasks.cs`)
- Platform runtimes → bflat compiler: targeted by
- GPU kernels → Bitcode converter: kernels through
