# dhruvbapat13/self-projects architecture

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

- Interactive diagram: https://gitdiagram.com/dhruvbapat13/self-projects
- Repository: https://github.com/dhruvbapat13/self-projects

## Overview

This repository contains several independent experiments: a NASM-like assembler and ELF linker, a location-area command-line client, and a small database runtime. The assembler workflow is visible from source input through parsing and encoding to object output; the linker entry point shows its object-processing stages through executable output. The database and CLI source files indicate their components, but the available evidence does not establish their internal call paths. The README describes no further product capabilities.

Main entry points: [`project1/nasm_clone/src/main.c`](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/main.c) (Assembler entry), [`project1/ld_clone/src/main.c`](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/main.c) (Linker entry), [`mycli/main.go`](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/main.go) (CLI entry), [`project1/nasm_clone/src/lexer.c`](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/lexer.c) (Lexer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_assembler["Assembler"]
  node_asm_main["Assembler entry<br/>[main.c]"]
  node_lexer["Lexer<br/>[lexer.c]"]
  node_parser["Parser and AST<br/>[parser.c]"]
  node_symtab["Symbol table<br/>[symtab.c]"]
  node_encoder["Instruction encoder<br/>[encoder.c]"]
  node_elf_writer["ELF object writer<br/>[elf64.c]"]
end

subgraph group_linker["Linker"]
  node_link_main["Linker entry<br/>[main.c]"]
  node_object_parser["Object parser<br/>[elf_parser.c]"]
  node_global_symbols["Symbol resolver<br/>[sym_resolver.c]"]
  node_layout["Memory layout<br/>[layout.c]"]
  node_relocator["Relocation engine<br/>[relocate.c]"]
  node_executable_writer["Executable writer<br/>[linker.c]"]
end

subgraph group_cli["Location CLI"]
  node_cli_entry["CLI entry<br/>[main.go]"]
  node_repl["REPL<br/>[repl.go]"]
  node_commands["Command dispatch<br/>[command_map.go]"]
  node_help_command["Help command<br/>[com_help.go]"]
  node_exit_command["Exit command<br/>[com_exit.go]"]
  node_api_client["Location API client<br/>[clapi.go]"]
  node_location_request["Area request"]
  node_location_types["Location types"]
  node_cache_client["Cache API client<br/>[clcacheapi.go]"]
end

subgraph group_db["Mini Database"]
  node_db_entry["Database entry<br/>[main.cpp]"]
  node_buffer_pool["Buffer pool"]
  node_lru["LRU replacer<br/>[lru_replacer.cpp]"]
  node_table_heap["Table heap<br/>[table_heap.cpp]"]
  node_bplus_tree["B+ tree<br/>[b_plus_tree.cpp]"]
  node_tree_internal["Internal tree pages"]
  node_tree_leaf["Leaf tree pages"]
  node_disk_manager[("Disk manager<br/>[disk_manager.cpp]")]
  node_slotted_page["Slotted pages<br/>[slotted_page.cpp]"]
end

node_asm_user(("Assembler user"))
node_link_user(("Linker user"))
node_cli_user(("CLI user"))

node_asm_user -->|"provides source"| node_asm_main
node_asm_main -->|"initializes"| node_lexer
node_asm_main -->|"parses source"| node_parser
node_asm_main -->|"initializes"| node_symtab
node_asm_main -->|"encodes AST"| node_encoder
node_asm_main -->|"writes object"| node_elf_writer
node_link_user -->|"provides object"| node_link_main
node_link_main -->|"parses object"| node_object_parser
node_link_main -->|"resolves symbols"| node_global_symbols
node_link_main -->|"plans layout"| node_layout
node_link_main -->|"applies relocations"| node_relocator
node_link_main -->|"writes executable"| node_executable_writer
node_cli_user -->|"starts"| node_cli_entry
node_cli_entry -->|"creates client"| node_api_client
node_cli_entry -->|"starts REPL"| node_repl

click node_asm_main "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/main.c"
click node_lexer "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/lexer.c"
click node_parser "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/parser.c"
click node_symtab "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/symtab.c"
click node_encoder "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/encoder.c"
click node_elf_writer "https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/elf64.c"
click node_link_main "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/main.c"
click node_object_parser "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/elf_parser.c"
click node_global_symbols "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/sym_resolver.c"
click node_layout "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/layout.c"
click node_relocator "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/relocate.c"
click node_executable_writer "https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/linker.c"
click node_cli_entry "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/main.go"
click node_repl "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/repl.go"
click node_commands "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/command_map.go"
click node_help_command "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/com_help.go"
click node_exit_command "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/com_exit.go"
click node_api_client "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/clapi.go"
click node_location_request "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/location_area_req.go"
click node_location_types "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/types_location_area.go"
click node_cache_client "https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clcacheapi/clcacheapi.go"
click node_db_entry "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/main.cpp"
click node_buffer_pool "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/buffer/buffer_pool_manager.cpp"
click node_lru "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/buffer/lru_replacer.cpp"
click node_table_heap "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/execution/table_heap.cpp"
click node_bplus_tree "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree.cpp"
click node_tree_internal "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree_internal_page.cpp"
click node_tree_leaf "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree_leaf_page.cpp"
click node_disk_manager "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/storage/disk/disk_manager.cpp"
click node_slotted_page "https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/storage/page/slotted_page.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_asm_main,node_lexer,node_parser,node_symtab,node_encoder,node_elf_writer,node_asm_user,node_link_user,node_cli_user toneBlue
class node_link_main,node_object_parser,node_global_symbols,node_layout,node_relocator,node_executable_writer toneAmber
class node_cli_entry,node_repl,node_commands,node_help_command,node_exit_command,node_api_client,node_location_request,node_location_types,node_cache_client toneMint
class node_db_entry,node_buffer_pool,node_lru,node_table_heap,node_bplus_tree,node_tree_internal,node_tree_leaf,node_disk_manager,node_slotted_page toneRose
```

## Components

### Assembler

- [Assembler entry](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/main.c): `project1/nasm_clone/src/main.c`
- [Lexer](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/lexer.c): `project1/nasm_clone/src/lexer.c`
- [Parser and AST](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/parser.c): `project1/nasm_clone/src/parser.c`
- [Symbol table](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/symtab.c): `project1/nasm_clone/src/symtab.c`
- [Instruction encoder](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/encoder.c): `project1/nasm_clone/src/encoder.c`
- [ELF object writer](https://github.com/dhruvbapat13/self-projects/blob/main/project1/nasm_clone/src/elf64.c): `project1/nasm_clone/src/elf64.c`

### Linker

- [Linker entry](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/main.c): `project1/ld_clone/src/main.c`
- [Object parser](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/elf_parser.c): `project1/ld_clone/src/elf_parser.c`
- [Symbol resolver](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/sym_resolver.c): `project1/ld_clone/src/sym_resolver.c`
- [Memory layout](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/layout.c): `project1/ld_clone/src/layout.c`
- [Relocation engine](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/relocate.c): `project1/ld_clone/src/relocate.c`
- [Executable writer](https://github.com/dhruvbapat13/self-projects/blob/main/project1/ld_clone/src/linker.c): `project1/ld_clone/src/linker.c`

### Location CLI

- [CLI entry](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/main.go): `mycli/main.go`
- [REPL](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/repl.go): `mycli/repl.go`
- [Command dispatch](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/command_map.go): `mycli/command_map.go`
- [Help command](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/com_help.go): `mycli/com_help.go`
- [Exit command](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/com_exit.go): `mycli/com_exit.go`
- [Location API client](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/clapi.go): `mycli/internal/clapi/clapi.go`
- [Area request](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/location_area_req.go): `mycli/internal/clapi/location_area_req.go`
- [Location types](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clapi/types_location_area.go): `mycli/internal/clapi/types_location_area.go`
- [Cache API client](https://github.com/dhruvbapat13/self-projects/blob/main/mycli/internal/clcacheapi/clcacheapi.go): `mycli/internal/clcacheapi/clcacheapi.go`

### Mini Database

- [Database entry](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/main.cpp): `minidb/src/main.cpp`
- [Buffer pool](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/buffer/buffer_pool_manager.cpp): `minidb/src/buffer/buffer_pool_manager.cpp`
- [LRU replacer](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/buffer/lru_replacer.cpp): `minidb/src/buffer/lru_replacer.cpp`
- [Table heap](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/execution/table_heap.cpp): `minidb/src/execution/table_heap.cpp`
- [B+ tree](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree.cpp): `minidb/src/index/b_plus_tree.cpp`
- [Internal tree pages](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree_internal_page.cpp): `minidb/src/index/b_plus_tree_internal_page.cpp`
- [Leaf tree pages](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/index/b_plus_tree_leaf_page.cpp): `minidb/src/index/b_plus_tree_leaf_page.cpp`
- [Disk manager](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/storage/disk/disk_manager.cpp): `minidb/src/storage/disk/disk_manager.cpp`
- [Slotted pages](https://github.com/dhruvbapat13/self-projects/blob/main/minidb/src/storage/page/slotted_page.cpp): `minidb/src/storage/page/slotted_page.cpp`

### Other components

- **Assembler user**
- **Linker user**
- **CLI user**

## Connections

- Assembler user → Assembler entry: provides source (evidence: `project1/nasm_clone/src/main.c`)
- Assembler entry → Lexer: initializes (evidence: `project1/nasm_clone/src/main.c`)
- Assembler entry → Parser and AST: parses source (evidence: `project1/nasm_clone/src/main.c`)
- Assembler entry → Symbol table: initializes (evidence: `project1/nasm_clone/src/main.c`)
- Assembler entry → Instruction encoder: encodes AST (evidence: `project1/nasm_clone/src/main.c`)
- Assembler entry → ELF object writer: writes object (evidence: `project1/nasm_clone/src/main.c`)
- Linker user → Linker entry: provides object (evidence: `project1/ld_clone/src/main.c`)
- Linker entry → Object parser: parses object (evidence: `project1/ld_clone/src/main.c`)
- Linker entry → Symbol resolver: resolves symbols (evidence: `project1/ld_clone/src/main.c`)
- Linker entry → Memory layout: plans layout (evidence: `project1/ld_clone/src/main.c`)
- Linker entry → Relocation engine: applies relocations (evidence: `project1/ld_clone/src/main.c`)
- Linker entry → Executable writer: writes executable (evidence: `project1/ld_clone/src/main.c`)
- CLI user → CLI entry: starts (evidence: `mycli/main.go`)
- CLI entry → Location API client: creates client (evidence: `mycli/main.go`)
- CLI entry → REPL: starts REPL (evidence: `mycli/main.go`)
