# kartikjograna/sih26148 architecture

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

- Interactive diagram: https://gitdiagram.com/kartikjograna/sih26148
- Repository: https://github.com/kartikjograna/sih26148

## Overview

JOCKY is a command-line compiler for a forensic programming language. A user supplies a source file; the CLI reads it, tokenizes and parses it, checks semantics, generates LLVM-backed object code, and links an executable. The language model includes forensic probes and platform-specific functions. The CLI also offers optional hash reporting, while the source labels polymorphic obfuscation as a TODO. Relationships below follow the shown CLI and module references; unsampled implementation details are not inferred.

Main entry points: [`compiler/src/main.rs`](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/main.rs) (CLI driver), [`compiler/src/parser/parser.rs`](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/parser.rs) (Parser), [`compiler/src/codegen/mod.rs`](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/codegen/mod.rs) (LLVM code generator), [`compiler/src/parser/ast.rs`](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/ast.rs) (Program AST)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Language Frontend"]
  node_lexer["Lexer<br/>[scanner.rs]"]
  node_tokens["Token types<br/>[token.rs]"]
  node_parser["Parser<br/>[parser.rs]"]
  node_ast["Program AST<br/>[ast.rs]"]
end

subgraph group_analysis["Semantic Analysis"]
  node_sema["Semantic analyzer<br/>[mod.rs]"]
end

subgraph group_backend["Code Generation"]
  node_codegen["LLVM code generator<br/>[mod.rs]"]
end

subgraph group_cli["Compiler CLI"]
  node_cli["CLI driver<br/>[main.rs]"]
  node_hash["SHA-256 digest<br/>[main.rs]"]
end

node_user(("Compiler user"))
node_source["JOCKY source"]
node_object["Object file"]
node_linker["System linker"]
node_executable["Executable"]

node_user -->|"invokes"| node_cli
node_source -->|"read by"| node_cli
node_cli -->|"tokenizes with"| node_lexer
node_lexer -->|"produces"| node_tokens
node_cli -->|"parses with"| node_parser
node_parser -->|"consumes"| node_tokens
node_parser -->|"builds"| node_ast
node_cli -->|"analyzes with"| node_sema
node_sema -->|"checks"| node_ast
node_cli -->|"generates from"| node_codegen
node_codegen -->|"consumes"| node_ast
node_codegen -->|"emits"| node_object
node_cli -->|"links with"| node_linker
node_linker -->|"produces"| node_executable
node_cli -->|"passes to linker"| node_object
node_cli -->|"hashes optionally"| node_executable
node_cli -->|"computes"| node_hash

click node_cli "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/main.rs"
click node_lexer "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/lexer/scanner.rs"
click node_tokens "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/lexer/token.rs"
click node_parser "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/parser.rs"
click node_ast "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/ast.rs"
click node_sema "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/sema/mod.rs"
click node_codegen "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/codegen/mod.rs"
click node_hash "https://github.com/kartikjograna/sih26148/blob/main/compiler/src/main.rs"

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_lexer,node_tokens,node_parser,node_ast,node_user toneBlue
class node_sema toneAmber
class node_codegen toneMint
class node_cli,node_hash toneRose
class node_source,node_object,node_linker,node_executable toneIndigo
```

## Components

### Language Frontend

- [Lexer](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/lexer/scanner.rs): `compiler/src/lexer/scanner.rs`
- [Token types](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/lexer/token.rs): `compiler/src/lexer/token.rs`
- [Parser](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/parser.rs): `compiler/src/parser/parser.rs`
- [Program AST](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/parser/ast.rs): `compiler/src/parser/ast.rs`

### Semantic Analysis

- [Semantic analyzer](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/sema/mod.rs): `compiler/src/sema/mod.rs`

### Code Generation

- [LLVM code generator](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/codegen/mod.rs): `compiler/src/codegen/mod.rs`

### Compiler CLI

- [CLI driver](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/main.rs): `compiler/src/main.rs`
- [SHA-256 digest](https://github.com/kartikjograna/sih26148/blob/main/compiler/src/main.rs): `compiler/src/main.rs`

### Other components

- **Compiler user**
- **JOCKY source**
- **Object file**
- **System linker**
- **Executable**

## Connections

- Compiler user → CLI driver: invokes (evidence: `compiler/src/main.rs`)
- JOCKY source → CLI driver: read by (evidence: `compiler/src/main.rs`)
- CLI driver → Lexer: tokenizes with (evidence: `compiler/src/main.rs`)
- Lexer → Token types: produces (evidence: `compiler/src/lexer/scanner.rs`)
- CLI driver → Parser: parses with (evidence: `compiler/src/main.rs`)
- Parser → Token types: consumes (evidence: `compiler/src/parser/parser.rs`)
- Parser → Program AST: builds (evidence: `compiler/src/parser/parser.rs`)
- CLI driver → Semantic analyzer: analyzes with (evidence: `compiler/src/main.rs`)
- Semantic analyzer → Program AST: checks (evidence: `compiler/src/sema/mod.rs`)
- CLI driver → LLVM code generator: generates from (evidence: `compiler/src/main.rs`)
- LLVM code generator → Program AST: consumes (evidence: `compiler/src/codegen/mod.rs`)
- LLVM code generator → Object file: emits (evidence: `compiler/src/codegen/mod.rs`)
- CLI driver → System linker: links with (evidence: `compiler/src/main.rs`)
- System linker → Executable: produces
- CLI driver → Object file: passes to linker (evidence: `compiler/src/main.rs`)
- CLI driver → Executable: hashes optionally (evidence: `compiler/src/main.rs`)
- CLI driver → SHA-256 digest: computes (evidence: `compiler/src/main.rs`)
