# aristrahatsuyu/flyuxc architecture

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

- Interactive diagram: https://gitdiagram.com/aristrahatsuyu/flyuxc
- Repository: https://github.com/aristrahatsuyu/flyuxc

## Overview

FLYUXC is an ahead-of-time compiler for the FLYUX language, including Unicode/emoji identifiers, type inference, and native executable generation. Its main workflow reads a source file, normalizes it, maps variable names, lexes and parses it, generates LLVM IR, then asks the LLVM backend to produce an executable. The runtime supplies value operations and built-ins such as arrays, strings, file I/O, JSON, and math. Error reporting is a shared internal layer for source-position diagnostics. The README documents additional language capabilities not fully evidenced in the sampled source; those are represented at the relevant stages without asserting unsampled call wiring.

Main entry points: [`src/backend/codegen/codegen.c`](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen.c) (LLVM IR generation), [`src/main.c`](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/main.c) (CLI entry), [`src/frontend/parser/parser.c`](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/parser/parser.c) (AST parser), [`src/backend/llvm_compiler.cpp`](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/llvm_compiler.cpp) (LLVM compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_normalize["Source normalization<br/>[normalize.c]"]
  node_varmap["Identifier mapping<br/>[varmap.c]"]
  node_lexer["Unicode lexer<br/>[lexer.c]"]
  node_parser["AST parser<br/>[parser.c]"]
  node_ast["Program AST<br/>[ast.h]"]
end

subgraph group_codegen["Code Generation"]
  node_codegen["LLVM IR generation<br/>[codegen.c]"]
  node_exprgen["Expression generation<br/>[codegen_expr.c]"]
  node_closuregen["Closure generation<br/>[codegen_closure.c]"]
  node_ir["LLVM IR"]
end

subgraph group_runtime["Runtime"]
  node_values["Runtime values"]
  node_arrays["Arrays and objects"]
  node_strings["Strings and casts"]
  node_builtins["Runtime built-ins<br/>[value_runtime.c]"]
  node_runtime_io["File and console I/O"]
  node_json["JSON operations"]
  node_math["Math operations"]
end

subgraph group_backend["Native Backend"]
  node_llvm["LLVM compiler<br/>[llvm_compiler.cpp]"]
  node_runtime_embed["Embedded runtime data<br/>[embed_runtime.c]"]
end

subgraph group_support["Compiler Support"]
  node_cli["CLI entry<br/>[main.c]"]
  node_io["Source file I/O<br/>[io.c]"]
  node_errors["Source diagnostics<br/>[error.c]"]
end

node_user(("Compiler user"))
node_input["FLYUX source"]
node_executable["Native executable"]

node_user -->|"invokes"| node_cli
node_cli -->|"reads source"| node_io
node_io -->|"loads"| node_input
node_cli -->|"normalizes"| node_normalize
node_cli -->|"maps identifiers"| node_varmap
node_cli -->|"tokenizes"| node_lexer
node_cli -->|"parses tokens"| node_parser
node_parser -->|"builds"| node_ast
node_cli -->|"generates IR"| node_codegen
node_codegen -->|"dispatches expressions"| node_exprgen
node_codegen -->|"generates closures"| node_closuregen
node_codegen -->|"emits"| node_ir
node_cli -->|"compiles IR"| node_llvm
node_llvm -->|"loads embedded runtime"| node_runtime_embed
node_llvm -->|"links native output"| node_executable
node_codegen -->|"emits runtime calls"| node_values
node_codegen -->|"emits array calls"| node_arrays
node_codegen -->|"emits builtin calls"| node_builtins
node_codegen -->|"emits I/O calls"| node_runtime_io
node_codegen -->|"emits JSON calls"| node_json
node_codegen -->|"emits math calls"| node_math
node_codegen -->|"emits string calls"| node_strings
node_cli -->|"reports diagnostics"| node_errors
node_parser -->|"reports diagnostics"| node_errors

click node_cli "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/main.c"
click node_io "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/utils/io/io.c"
click node_normalize "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/normalize.c"
click node_varmap "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/varmap.c"
click node_lexer "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/lexer.c"
click node_parser "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/parser/parser.c"
click node_ast "https://github.com/aristrahatsuyu/flyuxc/blob/main/include/flyuxc/frontend/ast.h"
click node_codegen "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen.c"
click node_exprgen "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen_expr.c"
click node_closuregen "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen_closure.c"
click node_llvm "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/llvm_compiler.cpp"
click node_runtime_embed "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/embed_runtime.c"
click node_values "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_value.c"
click node_arrays "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_array.c"
click node_strings "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_string.c"
click node_builtins "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime.c"
click node_runtime_io "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_file.c"
click node_json "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_json.c"
click node_math "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_math.c"
click node_errors "https://github.com/aristrahatsuyu/flyuxc/blob/main/src/core/error.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_normalize,node_varmap,node_lexer,node_parser,node_ast,node_user toneBlue
class node_codegen,node_exprgen,node_closuregen,node_ir toneAmber
class node_values,node_arrays,node_strings,node_builtins,node_runtime_io,node_json,node_math toneMint
class node_llvm,node_runtime_embed toneRose
class node_cli,node_io,node_errors,node_input,node_executable toneIndigo
```

## Components

### Frontend

- [Source normalization](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/normalize.c): `src/frontend/lexer/normalize.c`
- [Identifier mapping](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/varmap.c): `src/frontend/lexer/varmap.c`
- [Unicode lexer](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/lexer/lexer.c): `src/frontend/lexer/lexer.c`
- [AST parser](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/frontend/parser/parser.c): `src/frontend/parser/parser.c`
- [Program AST](https://github.com/aristrahatsuyu/flyuxc/blob/main/include/flyuxc/frontend/ast.h): `include/flyuxc/frontend/ast.h`

### Code Generation

- [LLVM IR generation](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen.c): `src/backend/codegen/codegen.c`
- [Expression generation](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen_expr.c): `src/backend/codegen/codegen_expr.c`
- [Closure generation](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/codegen/codegen_closure.c): `src/backend/codegen/codegen_closure.c`
- **LLVM IR**

### Runtime

- [Runtime values](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_value.c): `src/backend/runtime/value_runtime_value.c`
- [Arrays and objects](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_array.c): `src/backend/runtime/value_runtime_array.c`
- [Strings and casts](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_string.c): `src/backend/runtime/value_runtime_string.c`
- [Runtime built-ins](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime.c): `src/backend/runtime/value_runtime.c`
- [File and console I/O](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_file.c): `src/backend/runtime/value_runtime_file.c`
- [JSON operations](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_json.c): `src/backend/runtime/value_runtime_json.c`
- [Math operations](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/runtime/value_runtime_math.c): `src/backend/runtime/value_runtime_math.c`

### Native Backend

- [LLVM compiler](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/llvm_compiler.cpp): `src/backend/llvm_compiler.cpp`
- [Embedded runtime data](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/backend/embed_runtime.c): `src/backend/embed_runtime.c`

### Compiler Support

- [CLI entry](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/main.c): `src/main.c`
- [Source file I/O](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/utils/io/io.c): `src/utils/io/io.c`
- [Source diagnostics](https://github.com/aristrahatsuyu/flyuxc/blob/main/src/core/error.c): `src/core/error.c`

### Other components

- **Compiler user**
- **FLYUX source**
- **Native executable**

## Connections

- Compiler user → CLI entry: invokes
- CLI entry → Source file I/O: reads source
- Source file I/O → FLYUX source: loads
- CLI entry → Source normalization: normalizes
- CLI entry → Identifier mapping: maps identifiers
- CLI entry → Unicode lexer: tokenizes
- CLI entry → AST parser: parses tokens
- AST parser → Program AST: builds
- CLI entry → LLVM IR generation: generates IR
- LLVM IR generation → Expression generation: dispatches expressions
- LLVM IR generation → Closure generation: generates closures
- LLVM IR generation → LLVM IR: emits
- CLI entry → LLVM compiler: compiles IR
- LLVM compiler → Embedded runtime data: loads embedded runtime
- LLVM compiler → Native executable: links native output
- LLVM IR generation → Runtime values: emits runtime calls
- LLVM IR generation → Arrays and objects: emits array calls
- LLVM IR generation → Runtime built-ins: emits builtin calls
- LLVM IR generation → File and console I/O: emits I/O calls
- LLVM IR generation → JSON operations: emits JSON calls
- LLVM IR generation → Math operations: emits math calls
- LLVM IR generation → Strings and casts: emits string calls
- CLI entry → Source diagnostics: reports diagnostics
- AST parser → Source diagnostics: reports diagnostics
