How yusupov-muhammadyusuf/hyperlang works
Purpose and executable entry point
Hyper is an early-stage experimental programming language implemented in Rust. The repository builds the official interpreter, intended to explore Python-like syntax with future performance and memory-safety goals. The executable starts in src/main.rs; package/build/runtime dependency definitions are in Cargo.toml.
Interpreter orchestration
src/main.rs is the control-plane entry point: it is expected to accept source input, invoke lexical scanning and parsing, then execute the resulting program through the interpreter. This is a single-process native CLI interpreter rather than a web or service architecture.
• src/main.rs
• src/interpreter.rs
Lexical analysis
The scanner converts raw Hyper source text into tokens for the parser. This is the boundary between character-level syntax concerns—keywords, literals, operators, delimiters, and source positions—and structured language processing.
• src/scanner.rs
• src/parser.rs
Parsing and language representation
The parser consumes scanner output and constructs the syntactic representation used by execution. It defines the language’s grammar boundary: invalid token sequences should be rejected here, while valid expressions/statements are passed to the evaluator.
• src/parser.rs
• src/scanner.rs
• src/interpreter.rs
Evaluation/runtime semantics
The interpreter evaluates parsed Hyper constructs and implements current language behavior. It is the key execution boundary between syntax trees and runtime values, control flow, operations, and error behavior. As the language evolves, performance-sensitive execution and safety semantics will concentrate here.
• src/interpreter.rs
• src/parser.rs
• src/environment.rs
Environment and scope state
The environment component maintains runtime bindings and scope-visible state for program execution. The interpreter should use this layer rather than directly coupling evaluation logic to variable storage, making lexical scope, assignment, lookup, and future nested/function environments explicit runtime concerns.
• src/environment.rs
• src/interpreter.rs
Primary flow and infrastructure
Primary data flow is: source input → scanner tokens → parser syntax representation → interpreter evaluation → environment reads/writes and observable results. Rust/Cargo provide the material build and native runtime infrastructure; dependency resolution is captured in Cargo.toml and Cargo.lock. No external services, databases, web infrastructure, or distributed components are indicated by the repository tree.
• src/main.rs
• src/scanner.rs
• src/parser.rs
• src/interpreter.rs
Main entry points: interpreter.rs Interpreter · main.rs CLI Entry Point · scanner.rs Scanner · parser.rs Parser
Components 8
Language Frontend
Execution Runtime
- Interpreter · Executes parsed constructs and language semantics.
src/interpreter.rs - Environment · Stores runtime bindings for lookup and assignment.
src/environment.rs - Observable Results
Other components
- Cargo Build · Builds the native interpreter and resolves dependencies.
Cargo.toml - CLI Entry Point · Accepts source input and coordinates interpretation.
src/main.rs
Connections 8
- Cargo Build → CLI Entry Point: builds
- Hyper Source → CLI Entry Point: provided to
- CLI Entry Point → Scanner: scans
- Scanner → Parser: tokens
- Parser → Interpreter: syntax representation
- CLI Entry Point → Interpreter: invokes
- Interpreter → Environment: reads and writes bindings
- Interpreter → Observable Results: produces