# arturmarschenkulov/ice-lang-rust architecture

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

- Interactive diagram: https://gitdiagram.com/arturmarschenkulov/ice-lang-rust
- Repository: https://github.com/arturmarschenkulov/ice-lang-rust

## Overview

Icelang is a strongly and statically typed language project, currently centered on source lexing, parsing, AST construction, and checking. The principal workflow is that a user supplies source text or a file; the CLI reads it, lexes tokens, parses a project AST, and prints source, token, and AST views. The checker is a distinct implementation stage, though the shown excerpts do not establish how the CLI invokes it. The compiler file contains commented-out LLVM code, so it is not represented as an active product stage. Connections for unsampled checker behavior are left out or marked unverified.

Main entry points: [`src/main.rs`](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/main.rs) (CLI runner), [`src/lexer/mod.rs`](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/mod.rs) (Lexer), [`src/parser/mod.rs`](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/mod.rs) (Project parser), [`src/parser/ast.rs`](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/ast.rs) (Language AST)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and display"]
  node_cli["CLI runner<br/>[main.rs]"]
  node_file_read["File input<br/>[main.rs]"]
  node_display["Stage display<br/>[tui.rs]"]
end

subgraph group_lexing["Lexical analysis"]
  node_lexer["Lexer<br/>[mod.rs]"]
  node_tokens["Token model<br/>[token.rs]"]
  node_cursor["Lex cursor<br/>[cursor.rs]"]
  node_spans["Source spans<br/>[span.rs]"]
  node_lex_errors["Lex errors<br/>[error.rs]"]
end

subgraph group_parsing["Parsing and AST"]
  node_parser["Project parser<br/>[mod.rs]"]
  node_expressions["Expression parser<br/>[expr.rs]"]
  node_items["Item parser<br/>[item.rs]"]
  node_precedence["Operator precedence<br/>[precedence.rs]"]
  node_ast["Language AST<br/>[ast.rs]"]
  node_ast_print["AST printer<br/>[ast_print.rs]"]
end

subgraph group_validation["Semantic validation"]
  node_checker["Type checker<br/>[check.rs]"]
end

node_user(("Source author"))

node_user -->|"supplies source"| node_cli
node_cli -->|"reads file"| node_file_read
node_cli -->|"lexes source"| node_lexer
node_lexer -->|"scans characters"| node_cursor
node_lexer -->|"produces tokens"| node_tokens
node_lexer -->|"assigns spans"| node_spans
node_lexer -->|"reports errors"| node_lex_errors
node_cursor -->|"tracks positions"| node_spans
node_cli -->|"parses tokens"| node_parser
node_parser -->|"parses expressions"| node_expressions
node_parser -->|"parses items"| node_items
node_expressions -->|"looks up binding"| node_precedence
node_expressions -->|"builds expressions"| node_ast
node_items -->|"builds items"| node_ast
node_parser -->|"returns project"| node_ast
node_cli -->|"prints stages"| node_display
node_display -->|"prints tokens"| node_tokens
node_display -->|"prints AST"| node_ast_print
node_ast_print -->|"renders tree"| node_ast
node_checker -->|"reads AST types"| node_ast
node_parser -.->|"may validate"| node_checker

click node_cli "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/main.rs"
click node_file_read "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/main.rs"
click node_display "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/tui.rs"
click node_lexer "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/mod.rs"
click node_tokens "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/token.rs"
click node_cursor "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/cursor.rs"
click node_spans "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/span.rs"
click node_lex_errors "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/error.rs"
click node_parser "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/mod.rs"
click node_expressions "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/expr.rs"
click node_items "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/item.rs"
click node_precedence "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/precedence.rs"
click node_ast "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/ast.rs"
click node_ast_print "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/ast_print.rs"
click node_checker "https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/check.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_cli,node_file_read,node_display toneBlue
class node_lexer,node_tokens,node_cursor,node_spans,node_lex_errors toneAmber
class node_parser,node_expressions,node_items,node_precedence,node_ast,node_ast_print toneMint
class node_checker toneRose
class node_user toneIndigo
```

## Components

### Input and display

- [CLI runner](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/main.rs): `src/main.rs`
- [File input](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/main.rs): `src/main.rs`
- [Stage display](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/tui.rs): `src/tui.rs`

### Lexical analysis

- [Lexer](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/mod.rs): `src/lexer/mod.rs`
- [Token model](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/token.rs): `src/lexer/token.rs`
- [Lex cursor](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/cursor.rs): `src/lexer/cursor.rs`
- [Source spans](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/span.rs): `src/lexer/span.rs`
- [Lex errors](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/lexer/error.rs): `src/lexer/error.rs`

### Parsing and AST

- [Project parser](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/mod.rs): `src/parser/mod.rs`
- [Expression parser](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/expr.rs): `src/parser/expr.rs`
- [Item parser](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/item.rs): `src/parser/item.rs`
- [Operator precedence](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/precedence.rs): `src/parser/precedence.rs`
- [Language AST](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/ast.rs): `src/parser/ast.rs`
- [AST printer](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/parser/ast_print.rs): `src/parser/ast_print.rs`

### Semantic validation

- [Type checker](https://github.com/arturmarschenkulov/ice-lang-rust/blob/main/src/check.rs): `src/check.rs`

### Other components

- **Source author**

## Connections

- Source author → CLI runner: supplies source (evidence: `src/main.rs`)
- CLI runner → File input: reads file (evidence: `src/main.rs`)
- CLI runner → Lexer: lexes source (evidence: `src/main.rs`)
- Lexer → Lex cursor: scans characters (evidence: `src/lexer/mod.rs`)
- Lexer → Token model: produces tokens (evidence: `src/lexer/mod.rs`)
- Lexer → Source spans: assigns spans (evidence: `src/lexer/mod.rs`)
- Lexer → Lex errors: reports errors (evidence: `src/lexer/mod.rs`)
- Lex cursor → Source spans: tracks positions (evidence: `src/lexer/cursor.rs`)
- CLI runner → Project parser: parses tokens (evidence: `src/main.rs`)
- Project parser → Expression parser: parses expressions (evidence: `src/parser/mod.rs`)
- Project parser → Item parser: parses items (evidence: `src/parser/mod.rs`)
- Expression parser → Operator precedence: looks up binding (evidence: `src/parser/expr.rs`)
- Expression parser → Language AST: builds expressions (evidence: `src/parser/expr.rs`)
- Item parser → Language AST: builds items (evidence: `src/parser/item.rs`)
- Project parser → Language AST: returns project (evidence: `src/parser/mod.rs`)
- CLI runner → Stage display: prints stages (evidence: `src/main.rs`)
- Stage display → Token model: prints tokens (evidence: `src/tui.rs`)
- Stage display → AST printer: prints AST (evidence: `src/tui.rs`)
- AST printer → Language AST: renders tree (evidence: `src/parser/ast_print.rs`)
- Type checker → Language AST: reads AST types (evidence: `src/check.rs`)
- Project parser → Type checker: may validate
