# nitrosaccharose/mini-rust-interpreter architecture

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

- Interactive diagram: https://gitdiagram.com/nitrosaccharose/mini-rust-interpreter
- Repository: https://github.com/nitrosaccharose/mini-rust-interpreter

## Overview

Mini Rust Interpreter accepts an expression in the Vue interface, sends it to a local Rust HTTP server, and displays the server’s result. The backend scans input into tokens, builds an AST, and evaluates it; assignments update variable memory, while the API returns a value only for expressions. The README describes a simple interpreter API, and the sampled source confirms arithmetic, assignments, variables, and trigonometric/logarithmic operators. Broader control-flow tokens exist, but their execution is not established by the sampled implementation.

Main entry points: [`backend_rust/src/main.rs`](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/main.rs) (TCP HTTP server), [`backend_rust/src/ast_builder.rs`](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/ast_builder.rs) (AST builder), [`front_vue/src/request.js`](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/request.js) (HTTP client), [`front_vue/src/App.vue`](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/App.vue) (Expression UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Vue interface"]
  node_vue_mount["Vue mount<br/>[main.js]"]
  node_interface["Expression UI<br/>[App.vue]"]
  node_http_client["HTTP client<br/>[request.js]"]
end

subgraph group_api["HTTP API"]
  node_server["TCP HTTP server<br/>[main.rs]"]
end

subgraph group_runtime["Interpreter runtime"]
  node_scanner["Scanner<br/>[scanner.rs]"]
  node_token_model["Token model<br/>[token.rs]"]
  node_token_types["Token types<br/>[token_type.rs]"]
  node_ast_builder["AST builder<br/>[ast_builder.rs]"]
  node_ast["AST nodes<br/>[ast.rs]"]
  node_actuator["Evaluator<br/>[actuator.rs]"]
  node_variables[("Variable memory<br/>[actuator.rs]")]
end

node_user(("User"))

node_user -->|"enters expression"| node_interface
node_vue_mount -->|"mounts app"| node_interface
node_interface -->|"sends input"| node_http_client
node_http_client -->|"HTTP request"| node_server
node_server -->|"scans input"| node_scanner
node_scanner -->|"creates tokens"| node_token_model
node_scanner -->|"uses kinds"| node_token_types
node_server -->|"passes tokens"| node_ast_builder
node_ast_builder -->|"reads tokens"| node_token_model
node_ast_builder -->|"checks kinds"| node_token_types
node_ast_builder -->|"builds nodes"| node_ast
node_server -->|"passes AST"| node_actuator
node_actuator -->|"evaluates tree"| node_ast
node_actuator -->|"reads or writes"| node_variables
node_server -->|"returns JSON"| node_http_client
node_http_client -->|"delivers result"| node_interface

click node_vue_mount "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/main.js"
click node_interface "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/App.vue"
click node_http_client "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/request.js"
click node_server "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/main.rs"
click node_scanner "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/scanner.rs"
click node_token_model "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/token.rs"
click node_token_types "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/token_type.rs"
click node_ast_builder "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/ast_builder.rs"
click node_ast "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/ast.rs"
click node_actuator "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/actuator.rs"
click node_variables "https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/actuator.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_vue_mount,node_interface,node_http_client,node_user toneBlue
class node_server toneAmber
class node_scanner,node_token_model,node_token_types,node_ast_builder,node_ast,node_actuator,node_variables toneMint
```

## Components

### Vue interface

- [Vue mount](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/main.js): `front_vue/src/main.js`
- [Expression UI](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/App.vue): `front_vue/src/App.vue`
- [HTTP client](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/front_vue/src/request.js): `front_vue/src/request.js`

### HTTP API

- [TCP HTTP server](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/main.rs): `backend_rust/src/main.rs`

### Interpreter runtime

- [Scanner](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/scanner.rs): `backend_rust/src/scanner.rs`
- [Token model](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/token.rs): `backend_rust/src/token.rs`
- [Token types](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/token_type.rs): `backend_rust/src/token_type.rs`
- [AST builder](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/ast_builder.rs): `backend_rust/src/ast_builder.rs`
- [AST nodes](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/ast.rs): `backend_rust/src/ast.rs`
- [Evaluator](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/actuator.rs): `backend_rust/src/actuator.rs`
- [Variable memory](https://github.com/nitrosaccharose/mini-rust-interpreter/blob/master/backend_rust/src/actuator.rs): `backend_rust/src/actuator.rs`

### Other components

- **User**

## Connections

- User → Expression UI: enters expression
- Vue mount → Expression UI: mounts app
- Expression UI → HTTP client: sends input
- HTTP client → TCP HTTP server: HTTP request
- TCP HTTP server → Scanner: scans input
- Scanner → Token model: creates tokens
- Scanner → Token types: uses kinds
- TCP HTTP server → AST builder: passes tokens
- AST builder → Token model: reads tokens
- AST builder → Token types: checks kinds
- AST builder → AST nodes: builds nodes
- TCP HTTP server → Evaluator: passes AST
- Evaluator → AST nodes: evaluates tree
- Evaluator → Variable memory: reads or writes
- TCP HTTP server → HTTP client: returns JSON
- HTTP client → Expression UI: delivers result
