From 81a262dafe4a53a86987a577aa161c3ef7dd4db5 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 11 May 2026 19:31:06 +0200 Subject: [PATCH 01/24] Improved markdown --- content/docs/get-started.mdx | 82 ++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/content/docs/get-started.mdx b/content/docs/get-started.mdx index 9c2330e..7b75cc6 100644 --- a/content/docs/get-started.mdx +++ b/content/docs/get-started.mdx @@ -1,46 +1,46 @@ --- title: Get Started -description: This guide will help you install the Mist CLI, understand its basic commands, and compile your first program. +description: This guide will walk you through installing the Mist CLI, setting up your development environment, and compiling your very first program. icon: Rocket --- -## Installation +## 1. Installation -Mist is distributed through Cargo. +Mist is currently distributed as a Cargo crate. To get started, you'll need to have the Rust toolchain installed. -Install the Mist compiler using: +Run the following command to install the Mist compiler: ```bash title="Terminal" cargo install mist-lang@0.0.1-alpha2 + ``` -Verify using +Once the installation finishes, verify it by checking the version: ```bash title="Terminal" mist version + ``` --- -## Usage +## 2. Setting Up Your Project + +Mist works alongside Cargo to handle the heavy lifting. Follow these steps to prepare your environment for your first "Hello World" program. + +### Initialize a New Project + +If you haven't already, create a new Cargo project and navigate into the directory: + +```bash title="Terminal" +cargo new my-mist-app +cd my-mist-app -```bash title="Compiles the project in the current directory" -mist build ``` -```bash title="Prints the compiler version" -mist version -``` +### Configure Mist -```bash title="Shows the help message and available commands" -mist help -``` - ---- - -## Hello World - -On your existing cargo project project (`cargo init` or `cargo new `). +Create a `mist.json` file in your root directory. This tells the compiler where to look for your source code and where to place the generated Rust files. ```json title="mist.json" { @@ -49,18 +49,54 @@ On your existing cargo project project (`cargo init` or `cargo new `). } ``` +### Link Cargo to Mist + +Since Mist compiles down to Rust, you need to point Cargo to the generated output. Update your `Cargo.toml` to include the following: + ```toml title="Cargo.toml" [[bin]] name = "main" path = "build/main.rs" + ``` -```bash title=".gitignore" -/build -``` +> **Pro Tip:** You’ll probably want to add `/build` to your `.gitignore` file to keep your repository clean! + +--- + +## 3. Your First Program + +Now for the fun part! Create a new file at `src/main.mist` and add the following code: ```cpp title="src/main.mist" void main() { println!("Hello World!"); } + ``` + +### Build and Run + +To turn your Mist code into an executable, use the `build` command: + +```bash title="Terminal" +mist build + +``` + +Once the build is successful, you can run your program using standard Cargo commands: + +```bash title="Terminal" +cargo run + +``` + +--- + +## Command Reference + +| Command | Description | +| -------------- | ---------------------------------------------------------------- | +| `mist build` | Compiles your `.mist` files into Rust code in the output folder. | +| `mist version` | Displays the current version of the Mist compiler. | +| `mist help` | Stuck? Use this to see all available commands and options. | From ff7a8e324072afbfc420214856e7269053db96ee Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 11 May 2026 19:35:26 +0200 Subject: [PATCH 02/24] pro tipc --- content/docs/get-started.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/docs/get-started.mdx b/content/docs/get-started.mdx index 7b75cc6..b86e1b2 100644 --- a/content/docs/get-started.mdx +++ b/content/docs/get-started.mdx @@ -88,9 +88,10 @@ Once the build is successful, you can run your program using standard Cargo comm ```bash title="Terminal" cargo run - ``` +> **Pro Tip:** If you encounter any rust errors, head to the build directory and analyze the output, if you see anything unusual in the output, report the issue at https://github.com/mist-go/mist + --- ## Command Reference From b4cfdf2ffddc0e65df9accf878ca340980f3d906 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 11 May 2026 19:36:01 +0200 Subject: [PATCH 03/24] removed whitespace on code blocks --- content/docs/get-started.mdx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/content/docs/get-started.mdx b/content/docs/get-started.mdx index b86e1b2..20c8321 100644 --- a/content/docs/get-started.mdx +++ b/content/docs/get-started.mdx @@ -12,14 +12,12 @@ Run the following command to install the Mist compiler: ```bash title="Terminal" cargo install mist-lang@0.0.1-alpha2 - ``` Once the installation finishes, verify it by checking the version: ```bash title="Terminal" mist version - ``` --- @@ -35,7 +33,6 @@ If you haven't already, create a new Cargo project and navigate into the directo ```bash title="Terminal" cargo new my-mist-app cd my-mist-app - ``` ### Configure Mist @@ -57,7 +54,6 @@ Since Mist compiles down to Rust, you need to point Cargo to the generated outpu [[bin]] name = "main" path = "build/main.rs" - ``` > **Pro Tip:** You’ll probably want to add `/build` to your `.gitignore` file to keep your repository clean! @@ -72,7 +68,6 @@ Now for the fun part! Create a new file at `src/main.mist` and add the following void main() { println!("Hello World!"); } - ``` ### Build and Run @@ -81,7 +76,6 @@ To turn your Mist code into an executable, use the `build` command: ```bash title="Terminal" mist build - ``` Once the build is successful, you can run your program using standard Cargo commands: From 92d3e3f21532fd93839041fc19cac4370b265bba Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 11 May 2026 19:47:15 +0200 Subject: [PATCH 04/24] intro updated --- content/docs/index.mdx | 47 ++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/content/docs/index.mdx b/content/docs/index.mdx index c472144..7a8fd89 100644 --- a/content/docs/index.mdx +++ b/content/docs/index.mdx @@ -1,41 +1,52 @@ --- title: Introduction -description: What Mist is and the thinking behind it. +description: Discover the philosophy and architecture behind Mist. icon: Brain --- -Mist is a systems programming language that compiles directly into Rust. +**Mist** is a systems programming language that compiles directly into Rust. -It exists to make Rust-based development feel more direct and less mentally heavy, while preserving Rust’s performance model and ecosystem. +It was designed to make high-performance development feel more direct and less mentally taxing, without compromising on the safety, performance, or ecosystem richness that Rust provides. -Mist does not replace Rust. It is another way of writing Rust-compatible systems code with a more ergonomic surface layer. +Mist is not a replacement for Rust. Instead, it serves as a more ergonomic surface layer for writing Rust-compatible systems code. It allows you to focus on the "what" while the compiler handles the "how" of idiomatic Rust generation. --- -## Philosophy +## Philosophy: Systems Programming, Refined -Mist is built around making systems programming feel calm, predictable, and easy to reason about. +Mist is built on the belief that systems programming should feel **calm, predictable, and easy to reason about**. -When working close to the system, developers constantly manage performance, correctness, and structure at the same time. As projects grow, this can create mental friction — not because the system is unclear, but because expressing it can feel heavy. +When working close to the metal, developers must balance performance, correctness, and structure. As projects scale, the "expression overhead"—the mental energy required to satisfy complex syntax—often creates friction. Mist reduces this friction by: + +* **Focusing on Flow:** Code should feel direct to write and require minimal "re-contextualization" when revisited months later. + + +* **Reducing Mental Friction:** By simplifying the surface syntax, your attention stays on solving the problem, not fighting the mechanics of expression. + + +* **Predictable Abstractions:** Every feature in Mist is designed to be transparent, ensuring you always understand the underlying system behavior. -Mist focuses on reducing that friction in how code is written and read, so attention stays on the problem being solved rather than the mechanics of expression. -The language is shaped around clarity and flow: code should feel direct to write, and easy to understand when revisited. --- ## What Mist Is -Mist is a Rust-compatible systems language with a compiled-to-Rust design. +Mist is a compiled-to-Rust language specifically engineered for developers who need Rust's power but want a leaner authoring experience. -This means: +### Key Characteristics: -- It integrates directly with the Rust ecosystem -- It compiles into idiomatic Rust code -- It preserves Rust’s performance characteristics -- It has no runtime or garbage collector -- It is designed to stay predictable and close to the metal +* **Native Ecosystem Integration:** Mist integrates directly with Cargo and existing Rust crates. -Mist provides a more ergonomic way of authoring systems code while remaining fully grounded in Rust’s type system and execution model. -It is especially designed for readability and structure in larger codebases, where Rust’s guarantees remain important but expression overhead becomes noticeable. +* **Idiomatic Output:** It compiles into clean, readable Rust code rather than opaque machine logic. + + +* **Zero-Cost Performance:** There is no runtime, no garbage collector, and no performance penalty. + + +* **Grounded Safety:** Mist remains fully powered by Rust’s type system and execution model. + + + +Mist is especially valuable for large-scale codebases where readability is paramount, but the strict guarantees of a systems language are non-negotiable. \ No newline at end of file From d390fdb22e1a1aa7cd3abe8a9e536bd6d865fb54 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 11 May 2026 20:26:54 +0200 Subject: [PATCH 05/24] limitations --- content/docs/limitations.mdx | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 content/docs/limitations.mdx diff --git a/content/docs/limitations.mdx b/content/docs/limitations.mdx new file mode 100644 index 0000000..07f5988 --- /dev/null +++ b/content/docs/limitations.mdx @@ -0,0 +1,70 @@ +--- +title: Status & Limitations +description: Understanding the Alpha state of Mist and our technical roadmap. +icon: TriangleAlert +--- + +Mist is currently in a **Volatile Alpha** stage. Our current priority is exploring **Syntax and Features**. We believe in stabilizing the developer experience and the "feel" of the language before locking in the deep architectural logic of the compiler. + +--- + +## The "Syntax-First" Philosophy + +Mist is currently in a phase of rapid iteration. We are intentionally keeping the **Semantics** flexible while we finalize the **Syntax**. + +* **The Goal:** Finalize a robust, ergonomic feature set first. + + +* **The Reasoning:** Implementing complex semantic analysis while features are still being added is inefficient. By stabilizing the syntax first, we ensure that adding full semantic depth becomes a cohesive, "single-step" process later in development. + + + +--- + +## Current Technical Trade-offs + +To allow for this rapid syntax exploration, the compiler currently uses a "Shim" model for certain complex Rust operations. + +### 1. The Construction Model + +To support Mist's unified **Class and Constructor** model, the compiler uses an experimental memory initialization pattern. + +* **Mechanism:** The compiler generates a "shell" using `MaybeUninit`, allowing `self` to be used inside the constructor logic. + + +* **Limitation:** Because full **Definite Assignment Analysis** (semantics) is not yet implemented, the compiler does not verify that every field is assigned. It currently relies on zeroing out memory as a placeholder. + + +* **Future Fix:** Once the syntax is frozen, we will implement the semantic checks required to generate standard, safe Rust struct literals. + + + +### 2. Inheritance + +Inheritance is a major planned feature but is currently **not implemented**. + +* **Status:** The syntax for inheritance is being designed, but it will not be functional until the semantic analyzer is built to handle v-tables and memory layouts in the emitted Rust code. + + + +--- + +## Feature Volatility + +Be aware that because we are focusing on syntax, keywords and structures may change between minor versions. Currently: + +* **Access Modifiers:** `public` and private defaults are being tested for various contexts (classes vs. structs, or `public(crate)`). + + +* **Pointers vs. References:** The `*` syntax for references (e.g., `self mut*`) is the current standard but is subject to refinement based on ecosystem feedback. + + +* **Trait Implementations:** The "In-Class" `impl` block is a core feature we are prioritizing for ergonomics. + + + +--- + +> **Alpha Warning:** Mist is currently a playground for defining a better way to write systems code. Expect breaking changes as we finalize the surface layer of the language. +> +> From 9fe44507c4da5f56a1b256982d30f0483feda5de Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 02:16:50 +0200 Subject: [PATCH 06/24] Page structure --- content/docs/index.mdx | 2 +- content/docs/meta.json | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 content/docs/meta.json diff --git a/content/docs/index.mdx b/content/docs/index.mdx index 7a8fd89..e5d7977 100644 --- a/content/docs/index.mdx +++ b/content/docs/index.mdx @@ -1,5 +1,5 @@ --- -title: Introduction +title: Philosophy description: Discover the philosophy and architecture behind Mist. icon: Brain --- diff --git a/content/docs/meta.json b/content/docs/meta.json new file mode 100644 index 0000000..cecc2c1 --- /dev/null +++ b/content/docs/meta.json @@ -0,0 +1,21 @@ +{ + "pages": [ + "---[Rocket]Introduction---", + "index", + "get-started", + "limitations", + + "---[Box]Components---", + "functions", + "structs", + "enums", + "classes", + "traits", + "pointers-references", + + "---[ArrowDownUp]Logic---", + "variables", + "control-flow", + "match-patterns" + ] +} \ No newline at end of file From 85d48bb973f7280449232353f3dcca465d0cf45a Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 02:28:40 +0200 Subject: [PATCH 07/24] Functions --- content/docs/functions.mdx | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 content/docs/functions.mdx diff --git a/content/docs/functions.mdx b/content/docs/functions.mdx new file mode 100644 index 0000000..ffc9f33 --- /dev/null +++ b/content/docs/functions.mdx @@ -0,0 +1,74 @@ +--- +title: Functions +description: Defining execution blocks with C-style ergonomics and Rust-powered safety. +icon: SquareFunction +--- + +Functions are the primary unit of execution in Mist. They prioritize a traditional declaration order, placing the return type before the identifier to ensure signatures remain easy to scan in complex systems. + +## Basic Syntax + +A standard function requires a return type, a name, and a body. Use the `void` keyword for functions that do not return a value. + +```cpp +i32 add(i32 a, i32 b) { + return a + b; +} + +void log_status(str* message) { + println!("{}", message); +} + +``` + +## Visibility & Exports + +Functions are private to their module by default. The `public` modifier exports the function for cross-module access. + +```cpp +public i32 get_version() { + return 1; +} + +``` + +## Mutable Parameters + +Parameters follow Rust’s ownership rules but use Mist’s local variable syntax. Use `mut` to allow a function to modify its local binding of a value. + +```cpp +void update_score(i32 mut current_score, i32 bonus) { + current_score = current_score + bonus; +} + +``` + +## Generics & Lifetimes + +Mist integrates type abstraction and memory management into a single generic block. Lifetimes and type parameters share the `< >` bracket following the identifier. + +```rust +public str'a* choose_longer<'a, T: Display>(str'a* s1, str'a* s2, T meta) { + println!("Metadata: {}", meta); + return if (s1.len() > s2.len()) { s1 } else { s2 }; +} + +``` + +## Attributes & Metadata + +Metadata is applied via the `#[attr]` syntax directly above the declaration for compiler hints or testing. + +```cpp +#[inline] +public bool is_active(u32 id) { + return id > 0; +} + +``` + +## Key Characteristics + +* **Scannable Signatures:** Placing return types first allows for rapid identification of a function's output. +* **Unified Abstraction:** Lifetimes and type constraints are declared in one location, reducing signature noise. +* **Zero-Cost Mapping:** Every function maps directly to a Rust `fn`, maintaining performance and ecosystem compatibility. \ No newline at end of file From 6fcd72f8f1b7ad58cbe160409ed8d568ae9cc660 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 02:40:55 +0200 Subject: [PATCH 08/24] structs --- content/docs/functions.mdx | 5 --- content/docs/structs.mdx | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 content/docs/structs.mdx diff --git a/content/docs/functions.mdx b/content/docs/functions.mdx index ffc9f33..9e23aa9 100644 --- a/content/docs/functions.mdx +++ b/content/docs/functions.mdx @@ -18,7 +18,6 @@ i32 add(i32 a, i32 b) { void log_status(str* message) { println!("{}", message); } - ``` ## Visibility & Exports @@ -29,7 +28,6 @@ Functions are private to their module by default. The `public` modifier exports public i32 get_version() { return 1; } - ``` ## Mutable Parameters @@ -40,7 +38,6 @@ Parameters follow Rust’s ownership rules but use Mist’s local variable synta void update_score(i32 mut current_score, i32 bonus) { current_score = current_score + bonus; } - ``` ## Generics & Lifetimes @@ -52,7 +49,6 @@ public str'a* choose_longer<'a, T: Display>(str'a* s1, str'a* s2, T meta) { println!("Metadata: {}", meta); return if (s1.len() > s2.len()) { s1 } else { s2 }; } - ``` ## Attributes & Metadata @@ -64,7 +60,6 @@ Metadata is applied via the `#[attr]` syntax directly above the declaration for public bool is_active(u32 id) { return id > 0; } - ``` ## Key Characteristics diff --git a/content/docs/structs.mdx b/content/docs/structs.mdx new file mode 100644 index 0000000..9a84305 --- /dev/null +++ b/content/docs/structs.mdx @@ -0,0 +1,64 @@ +--- +title: Structs +description: Data modeling using Mist's type-first convention. +icon: Form +--- + +Structs in Mist follow the same structural logic as Rust, but apply the language-wide `type name` declaration style and allow for comma-separated field grouping. + +## Basic Syntax + +A struct is defined by its name followed by a block of fields. Each field follows the Mist convention of placing the type before the identifier, separated by commas. + +```rust +public struct Task { + public String name, + public TaskState state, + public i32 executions, +} + +``` + +## Visibility + +Use the `public` modifier to make the struct or its individual fields accessible from other modules. + +```cpp +public struct NetworkNode { + public u32 id, + str* address, +} + +``` + +## Instantiation + +Structs are instantiated using the standard brace syntax. + +```cpp +var task = Task { + name: "Initialize".to_string(), + state: TaskState::Pending, + executions: 0, +}; + +``` + +## Generics & Lifetimes + +Generics and lifetimes are declared in angle brackets after the struct name. Lifetimes are associated with the reference/pointer type within the field declarations. + +```cpp +public struct Buffer<'a, T> { + public T'a* data, + public usize len, +} + +``` + +## Key Characteristics + +- **Type-First Declaration**: Fields use the `type name` order to match function parameters and variable declarations. +- **Comma-Separated Members**: Fields are separated by commas, maintaining a clean and consistent delimiter style. +- **Rust Compatibility**: Maps 1:1 to Rust structs, ensuring zero-cost abstraction and full ecosystem interoperability. +- **Direct Visibility**: The `public` keyword replaces `pub` for a more consistent modifier language across the codebase. From 9fcaa95eea25807476de2d6d59517895dc329dd9 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 02:48:03 +0200 Subject: [PATCH 09/24] enums --- content/docs/enums.mdx | 57 ++++++++++++++++++++++++++++++++++++++++ content/docs/structs.mdx | 4 --- 2 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 content/docs/enums.mdx diff --git a/content/docs/enums.mdx b/content/docs/enums.mdx new file mode 100644 index 0000000..dfc8fa2 --- /dev/null +++ b/content/docs/enums.mdx @@ -0,0 +1,57 @@ +--- +title: Enums +description: Defining algebraic data types with Mist's type-first convention. +icon: Layers +--- + +Enums in Mist serve as powerful algebraic data types (ADTs), maintaining the exact behavior and safety of Rust enums while applying the language-wide `type name` convention for variants that contain data. + +## Basic Syntax + +An enum can contain unit variants, tuple variants, or struct-like variants. Following Mist's core philosophy, struct-like variants place the type before the identifier. + +```rust +public enum TaskState { + Pending, + InProgress, + Completed, + // Struct-like variant using 'type name' + Failed { + String reason, + i32 code, + }, +} +``` +## Variant Types + +Mist supports all standard variant shapes, ensuring a 1:1 mapping to the underlying Rust execution model. + +```rust +enum Message { + Quit, // Unit + Move(i32, i32), // Tuple + Write(String), // Tuple + ChangeColor { // Struct-like + u8 r, u8 g, u8 b, + }, +} +``` +## Generics & Lifetimes + +Just like structs and functions, enums declare generics and lifetimes in a unified block. This is particularly useful for defining custom Result or Option types that handle references. + +```rust +public enum Validation<'a, T> { + Valid(T), + Invalid { + str'a* message, + u32 error_id, + }, +} +``` +## Key Characteristics + +- **Consistent Member Declaration**: Struct-like variants maintain the `type name` order, ensuring that data modeling feels identical whether you are defining a top-level `struct` or an `enum` variant. +- **Rust-Native ADTs**: Enums compile directly to Rust enums, allowing for exhaustive pattern matching and zero-cost abstraction. +- **Shared Visibility**: The `public` modifier at the enum level exports all variants for use in other modules, matching Rust's visibility rules for enums. +- **Comma-Separated Members**: Fields within struct-like variants are separated by commas, mirroring the syntax used in standard Mist structs. diff --git a/content/docs/structs.mdx b/content/docs/structs.mdx index 9a84305..1e04165 100644 --- a/content/docs/structs.mdx +++ b/content/docs/structs.mdx @@ -16,7 +16,6 @@ public struct Task { public TaskState state, public i32 executions, } - ``` ## Visibility @@ -28,7 +27,6 @@ public struct NetworkNode { public u32 id, str* address, } - ``` ## Instantiation @@ -41,7 +39,6 @@ var task = Task { state: TaskState::Pending, executions: 0, }; - ``` ## Generics & Lifetimes @@ -53,7 +50,6 @@ public struct Buffer<'a, T> { public T'a* data, public usize len, } - ``` ## Key Characteristics From db7c8b3034cc9581b15cf5950cf2d3aed71b7dd3 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:03:52 +0200 Subject: [PATCH 10/24] Classes --- content/docs/classes.mdx | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 content/docs/classes.mdx diff --git a/content/docs/classes.mdx b/content/docs/classes.mdx new file mode 100644 index 0000000..1195a3f --- /dev/null +++ b/content/docs/classes.mdx @@ -0,0 +1,64 @@ +--- +title: Classes +description: Unified data and behavior with Java-style organization and Rust-powered execution. +icon: Shapes +--- + +Classes in Mist bridge the gap between Java's organizational structure and Rust's performance. They allow you to define data fields, constructors, instance methods, and trait implementations within a single, cohesive block. + +## Basic Syntax + +A class groups fields and methods together. Fields follow the `type name` convention, and methods define their logic directly within the class body. + +```cpp +public class Logger { + String prefix; + + public void info(self*, str* message) { + self.log(LogLevel::Info, message); + } + + void log(self*, LogLevel level, str* message) { + println!("{level} {} {}", self.prefix, message); + } +} +``` + +## The Constructor + +Unlike languages that use the class name for initialization, Mist uses the explicit `constructor` keyword. This makes the entry point of the class unmistakable. + +```cpp +public constructor(str* prefix) { + self.prefix = prefix.to_string(); +} +``` + +## Instance Methods & `self` + +Mist maintains Rust's explicit context handling. Any method that needs to access or modify class data must include `self*` (or `self mut*` for mutations) as its first parameter. + +```cpp +public void warning(self*, str* message) { + self.log(LogLevel::Warning, message); +} +``` + +## Trait Implementations + +One of Mist's most powerful features is the ability to nest trait implementations directly within the class block. This keeps the logic for how a type behaves (e.g., how it is displayed) physically coupled with the type definition. + +```cpp +impl fmt::Display { + std::fmt::Result fmt(self*, std::fmt::Formatter<'_> mut* f) { + return write!(f, "logger ({})", self.prefix); + } +} +``` + +## Key Characteristics + +- **Unified Scope**: Data, behavior, and trait logic live in one place, eliminating the friction of jumping between `struct` and `impl` blocks. +- **Explicit Context**: The use of `self*` ensures that the relationship between a method and its instance is always transparent. +- **Encapsulation**: Visibility modifiers (`public`) allow you to expose a clean API while keeping internal helper methods and state private to the class. +- **Zero-Cost Classes**: Under the hood, Mist desugars these into idiomatic Rust structs and implementation blocks, ensuring no runtime overhead compared to raw Rust. From a30e3108e83db04f6ad5e7c29b01540233f229f3 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:06:37 +0200 Subject: [PATCH 11/24] Traits --- content/docs/traits.mdx | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 content/docs/traits.mdx diff --git a/content/docs/traits.mdx b/content/docs/traits.mdx new file mode 100644 index 0000000..512b3e8 --- /dev/null +++ b/content/docs/traits.mdx @@ -0,0 +1,61 @@ +--- +title: Traits +description: Defining shared behavior and contracts with Mist's signature ergonomics. +icon: Sparkles +--- + +Traits in Mist define a set of methods that a type must implement, facilitating polymorphism and shared behavior. While they mirror the logic of Rust traits, they utilize Mist’s **type-first** declaration style for method signatures. + +## Defining a Trait + +A trait definition lists method signatures that implementing types must satisfy. Like functions, these signatures place the return type before the method name. + +```rust +public trait Drawable { + void draw(self*); + str* metadata(self*); +} +``` +## Implementing a Trait + +To implement a trait for a specific type, use the `impl` keyword followed by the trait name and the target type. This block must contain all required methods defined in the trait. + +```rust +impl Drawable for Task { + void draw(self*) { + println!("Drawing task: {}", self.name); + } + + str* metadata(self*) { + return self.name; + } +} +``` +## Default Implementations + +Traits can provide default behavior for methods. Types implementing the trait can choose to override these defaults or use the provided implementation. + +```rust +public trait Identifiable { + u32 get_id(self*); + + bool is_valid(self*) { + return self.get_id() > 0; + } +} +``` +## Super-traits + +Traits can build upon other traits. If a trait requires another trait to be implemented first, use the colon `:` syntax. + +```rust +public trait Animated : Drawable { + void animate(self*, f32 delta_time); +} +``` +## Key Characteristics + +- **Consistent Signatures**: Method signatures within traits follow the language-wide `return_type name(params)` convention. +- **Explicit Context**: Methods use `self*` or `self mut*` as the first parameter to define how the instance is accessed, mapping directly to Rust's reference rules. +- **Static Dispatch**: By default, Mist traits leverage Rust's zero-cost generics and monomorphization, ensuring high performance. +- **Predictable Contracts**: Traits act as strict blueprints; the Mist compiler ensures every implementation perfectly matches the interface before generating the corresponding Rust code. From 8945e4fc90e7611d6f86218c5edc5fe0d343b239 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:10:18 +0200 Subject: [PATCH 12/24] Pointers and refrences --- content/docs/pointers-references.mdx | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 content/docs/pointers-references.mdx diff --git a/content/docs/pointers-references.mdx b/content/docs/pointers-references.mdx new file mode 100644 index 0000000..9a93fd5 --- /dev/null +++ b/content/docs/pointers-references.mdx @@ -0,0 +1,39 @@ +--- +title: Pointers & References +description: Explicit memory access with C-style ergonomics and Rust-native safety. +icon: MousePointer2 +--- + +Mist simplifies Rust’s reference system by using a pointer-style syntax. While the symbols look like C-style pointers, they adhere strictly to Rust’s ownership and borrowing rules. + +## Basic Syntax + +References are defined by placing a `*` after the type. By default, pointers are immutable (shared). To allow modification of the underlying data, use the `mut*` modifier. + +```cpp +void increment(i32 mut* value, i32* limit) { + if (value < limit) { + value = value + 1; + } +} + +``` + +## Lifetimes + +Lifetimes are attached directly to the type before the pointer symbol. This maintains a clean visual flow where the "type-contract" (identity, duration, and mutability) is read from left to right. + +```cpp +public struct Inspector<'a> { + public str'a* target, + public u32'a mut* counter, +} + +``` + +## Key Characteristics + +- **Explicit Intent:** The `mut*` syntax clearly distinguishes between a reference that can read and one that can write, mapping 1:1 to Rust's `&` and `&mut`. +- **Visual Consistency:** Lifetimes (`'a`) and mutability modifiers are integrated into the type declaration, keeping function signatures and struct fields compact. +- **Safety Guaranteed:** Despite the "pointer" appearance, the Mist compiler enforces Rust’s borrow checker. You cannot have multiple `mut*` references to the same data, and references cannot outlive their owners. +- **Zero Overhead:** Mist pointers are "thin" or "fat" exactly like Rust references; they carry no extra runtime metadata and compile to identical machine code. From e3413d05cefa1f919f9aaa1c8d5edca05245fe2c Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:12:23 +0200 Subject: [PATCH 13/24] Refactored componenst --- content/docs/{ => components}/classes.mdx | 0 content/docs/{ => components}/enums.mdx | 0 content/docs/{ => components}/functions.mdx | 0 .../docs/{ => components}/pointers-references.mdx | 0 content/docs/{ => components}/structs.mdx | 0 content/docs/{ => components}/traits.mdx | 0 content/docs/meta.json | 12 ++++++------ 7 files changed, 6 insertions(+), 6 deletions(-) rename content/docs/{ => components}/classes.mdx (100%) rename content/docs/{ => components}/enums.mdx (100%) rename content/docs/{ => components}/functions.mdx (100%) rename content/docs/{ => components}/pointers-references.mdx (100%) rename content/docs/{ => components}/structs.mdx (100%) rename content/docs/{ => components}/traits.mdx (100%) diff --git a/content/docs/classes.mdx b/content/docs/components/classes.mdx similarity index 100% rename from content/docs/classes.mdx rename to content/docs/components/classes.mdx diff --git a/content/docs/enums.mdx b/content/docs/components/enums.mdx similarity index 100% rename from content/docs/enums.mdx rename to content/docs/components/enums.mdx diff --git a/content/docs/functions.mdx b/content/docs/components/functions.mdx similarity index 100% rename from content/docs/functions.mdx rename to content/docs/components/functions.mdx diff --git a/content/docs/pointers-references.mdx b/content/docs/components/pointers-references.mdx similarity index 100% rename from content/docs/pointers-references.mdx rename to content/docs/components/pointers-references.mdx diff --git a/content/docs/structs.mdx b/content/docs/components/structs.mdx similarity index 100% rename from content/docs/structs.mdx rename to content/docs/components/structs.mdx diff --git a/content/docs/traits.mdx b/content/docs/components/traits.mdx similarity index 100% rename from content/docs/traits.mdx rename to content/docs/components/traits.mdx diff --git a/content/docs/meta.json b/content/docs/meta.json index cecc2c1..504d004 100644 --- a/content/docs/meta.json +++ b/content/docs/meta.json @@ -6,12 +6,12 @@ "limitations", "---[Box]Components---", - "functions", - "structs", - "enums", - "classes", - "traits", - "pointers-references", + "components/functions", + "components/structs", + "components/enums", + "components/classes", + "components/traits", + "components/pointers-references", "---[ArrowDownUp]Logic---", "variables", From 71016127f57c5d488fbb073951f233de9f74fdad Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:15:23 +0200 Subject: [PATCH 14/24] Small refactor to intro --- content/docs/get-started.mdx | 97 ------------------------------------ content/docs/index.mdx | 87 ++++++++++++++++++++++++-------- content/docs/meta.json | 2 +- content/docs/philosophy.mdx | 52 +++++++++++++++++++ src/app/(home)/page.tsx | 7 ++- 5 files changed, 124 insertions(+), 121 deletions(-) delete mode 100644 content/docs/get-started.mdx create mode 100644 content/docs/philosophy.mdx diff --git a/content/docs/get-started.mdx b/content/docs/get-started.mdx deleted file mode 100644 index 20c8321..0000000 --- a/content/docs/get-started.mdx +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: Get Started -description: This guide will walk you through installing the Mist CLI, setting up your development environment, and compiling your very first program. -icon: Rocket ---- - -## 1. Installation - -Mist is currently distributed as a Cargo crate. To get started, you'll need to have the Rust toolchain installed. - -Run the following command to install the Mist compiler: - -```bash title="Terminal" -cargo install mist-lang@0.0.1-alpha2 -``` - -Once the installation finishes, verify it by checking the version: - -```bash title="Terminal" -mist version -``` - ---- - -## 2. Setting Up Your Project - -Mist works alongside Cargo to handle the heavy lifting. Follow these steps to prepare your environment for your first "Hello World" program. - -### Initialize a New Project - -If you haven't already, create a new Cargo project and navigate into the directory: - -```bash title="Terminal" -cargo new my-mist-app -cd my-mist-app -``` - -### Configure Mist - -Create a `mist.json` file in your root directory. This tells the compiler where to look for your source code and where to place the generated Rust files. - -```json title="mist.json" -{ - "src": "src", - "output": "build" -} -``` - -### Link Cargo to Mist - -Since Mist compiles down to Rust, you need to point Cargo to the generated output. Update your `Cargo.toml` to include the following: - -```toml title="Cargo.toml" -[[bin]] -name = "main" -path = "build/main.rs" -``` - -> **Pro Tip:** You’ll probably want to add `/build` to your `.gitignore` file to keep your repository clean! - ---- - -## 3. Your First Program - -Now for the fun part! Create a new file at `src/main.mist` and add the following code: - -```cpp title="src/main.mist" -void main() { - println!("Hello World!"); -} -``` - -### Build and Run - -To turn your Mist code into an executable, use the `build` command: - -```bash title="Terminal" -mist build -``` - -Once the build is successful, you can run your program using standard Cargo commands: - -```bash title="Terminal" -cargo run -``` - -> **Pro Tip:** If you encounter any rust errors, head to the build directory and analyze the output, if you see anything unusual in the output, report the issue at https://github.com/mist-go/mist - ---- - -## Command Reference - -| Command | Description | -| -------------- | ---------------------------------------------------------------- | -| `mist build` | Compiles your `.mist` files into Rust code in the output folder. | -| `mist version` | Displays the current version of the Mist compiler. | -| `mist help` | Stuck? Use this to see all available commands and options. | diff --git a/content/docs/index.mdx b/content/docs/index.mdx index e5d7977..20c8321 100644 --- a/content/docs/index.mdx +++ b/content/docs/index.mdx @@ -1,52 +1,97 @@ --- -title: Philosophy -description: Discover the philosophy and architecture behind Mist. -icon: Brain +title: Get Started +description: This guide will walk you through installing the Mist CLI, setting up your development environment, and compiling your very first program. +icon: Rocket --- -**Mist** is a systems programming language that compiles directly into Rust. +## 1. Installation -It was designed to make high-performance development feel more direct and less mentally taxing, without compromising on the safety, performance, or ecosystem richness that Rust provides. +Mist is currently distributed as a Cargo crate. To get started, you'll need to have the Rust toolchain installed. -Mist is not a replacement for Rust. Instead, it serves as a more ergonomic surface layer for writing Rust-compatible systems code. It allows you to focus on the "what" while the compiler handles the "how" of idiomatic Rust generation. +Run the following command to install the Mist compiler: + +```bash title="Terminal" +cargo install mist-lang@0.0.1-alpha2 +``` + +Once the installation finishes, verify it by checking the version: + +```bash title="Terminal" +mist version +``` --- -## Philosophy: Systems Programming, Refined +## 2. Setting Up Your Project -Mist is built on the belief that systems programming should feel **calm, predictable, and easy to reason about**. +Mist works alongside Cargo to handle the heavy lifting. Follow these steps to prepare your environment for your first "Hello World" program. -When working close to the metal, developers must balance performance, correctness, and structure. As projects scale, the "expression overhead"—the mental energy required to satisfy complex syntax—often creates friction. Mist reduces this friction by: +### Initialize a New Project -* **Focusing on Flow:** Code should feel direct to write and require minimal "re-contextualization" when revisited months later. +If you haven't already, create a new Cargo project and navigate into the directory: +```bash title="Terminal" +cargo new my-mist-app +cd my-mist-app +``` -* **Reducing Mental Friction:** By simplifying the surface syntax, your attention stays on solving the problem, not fighting the mechanics of expression. +### Configure Mist +Create a `mist.json` file in your root directory. This tells the compiler where to look for your source code and where to place the generated Rust files. -* **Predictable Abstractions:** Every feature in Mist is designed to be transparent, ensuring you always understand the underlying system behavior. +```json title="mist.json" +{ + "src": "src", + "output": "build" +} +``` +### Link Cargo to Mist +Since Mist compiles down to Rust, you need to point Cargo to the generated output. Update your `Cargo.toml` to include the following: + +```toml title="Cargo.toml" +[[bin]] +name = "main" +path = "build/main.rs" +``` + +> **Pro Tip:** You’ll probably want to add `/build` to your `.gitignore` file to keep your repository clean! --- -## What Mist Is +## 3. Your First Program -Mist is a compiled-to-Rust language specifically engineered for developers who need Rust's power but want a leaner authoring experience. +Now for the fun part! Create a new file at `src/main.mist` and add the following code: -### Key Characteristics: +```cpp title="src/main.mist" +void main() { + println!("Hello World!"); +} +``` -* **Native Ecosystem Integration:** Mist integrates directly with Cargo and existing Rust crates. +### Build and Run +To turn your Mist code into an executable, use the `build` command: -* **Idiomatic Output:** It compiles into clean, readable Rust code rather than opaque machine logic. +```bash title="Terminal" +mist build +``` +Once the build is successful, you can run your program using standard Cargo commands: -* **Zero-Cost Performance:** There is no runtime, no garbage collector, and no performance penalty. +```bash title="Terminal" +cargo run +``` +> **Pro Tip:** If you encounter any rust errors, head to the build directory and analyze the output, if you see anything unusual in the output, report the issue at https://github.com/mist-go/mist -* **Grounded Safety:** Mist remains fully powered by Rust’s type system and execution model. +--- +## Command Reference - -Mist is especially valuable for large-scale codebases where readability is paramount, but the strict guarantees of a systems language are non-negotiable. \ No newline at end of file +| Command | Description | +| -------------- | ---------------------------------------------------------------- | +| `mist build` | Compiles your `.mist` files into Rust code in the output folder. | +| `mist version` | Displays the current version of the Mist compiler. | +| `mist help` | Stuck? Use this to see all available commands and options. | diff --git a/content/docs/meta.json b/content/docs/meta.json index 504d004..1fa753c 100644 --- a/content/docs/meta.json +++ b/content/docs/meta.json @@ -2,7 +2,7 @@ "pages": [ "---[Rocket]Introduction---", "index", - "get-started", + "philosophy", "limitations", "---[Box]Components---", diff --git a/content/docs/philosophy.mdx b/content/docs/philosophy.mdx new file mode 100644 index 0000000..e5d7977 --- /dev/null +++ b/content/docs/philosophy.mdx @@ -0,0 +1,52 @@ +--- +title: Philosophy +description: Discover the philosophy and architecture behind Mist. +icon: Brain +--- + +**Mist** is a systems programming language that compiles directly into Rust. + +It was designed to make high-performance development feel more direct and less mentally taxing, without compromising on the safety, performance, or ecosystem richness that Rust provides. + +Mist is not a replacement for Rust. Instead, it serves as a more ergonomic surface layer for writing Rust-compatible systems code. It allows you to focus on the "what" while the compiler handles the "how" of idiomatic Rust generation. + +--- + +## Philosophy: Systems Programming, Refined + +Mist is built on the belief that systems programming should feel **calm, predictable, and easy to reason about**. + +When working close to the metal, developers must balance performance, correctness, and structure. As projects scale, the "expression overhead"—the mental energy required to satisfy complex syntax—often creates friction. Mist reduces this friction by: + +* **Focusing on Flow:** Code should feel direct to write and require minimal "re-contextualization" when revisited months later. + + +* **Reducing Mental Friction:** By simplifying the surface syntax, your attention stays on solving the problem, not fighting the mechanics of expression. + + +* **Predictable Abstractions:** Every feature in Mist is designed to be transparent, ensuring you always understand the underlying system behavior. + + + +--- + +## What Mist Is + +Mist is a compiled-to-Rust language specifically engineered for developers who need Rust's power but want a leaner authoring experience. + +### Key Characteristics: + +* **Native Ecosystem Integration:** Mist integrates directly with Cargo and existing Rust crates. + + +* **Idiomatic Output:** It compiles into clean, readable Rust code rather than opaque machine logic. + + +* **Zero-Cost Performance:** There is no runtime, no garbage collector, and no performance penalty. + + +* **Grounded Safety:** Mist remains fully powered by Rust’s type system and execution model. + + + +Mist is especially valuable for large-scale codebases where readability is paramount, but the strict guarantees of a systems language are non-negotiable. \ No newline at end of file diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx index 6954def..7886f23 100644 --- a/src/app/(home)/page.tsx +++ b/src/app/(home)/page.tsx @@ -175,7 +175,7 @@ function ShowSection({ Get Started @@ -244,7 +244,10 @@ export default function HomePage() { }} className="flex flex-col items-center gap-1 text-muted-foreground" > - + From ecf4b16ec14c7e8c21d6c9a458626de677521d51 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:20:17 +0200 Subject: [PATCH 15/24] Variables --- .../docs/components/pointers-references.mdx | 2 - content/docs/logic/variables.mdx | 53 +++++++++++++++++++ content/docs/meta.json | 6 +-- 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 content/docs/logic/variables.mdx diff --git a/content/docs/components/pointers-references.mdx b/content/docs/components/pointers-references.mdx index 9a93fd5..eb74a20 100644 --- a/content/docs/components/pointers-references.mdx +++ b/content/docs/components/pointers-references.mdx @@ -16,7 +16,6 @@ void increment(i32 mut* value, i32* limit) { value = value + 1; } } - ``` ## Lifetimes @@ -28,7 +27,6 @@ public struct Inspector<'a> { public str'a* target, public u32'a mut* counter, } - ``` ## Key Characteristics diff --git a/content/docs/logic/variables.mdx b/content/docs/logic/variables.mdx new file mode 100644 index 0000000..90dbe1f --- /dev/null +++ b/content/docs/logic/variables.mdx @@ -0,0 +1,53 @@ +--- +title: Variables +description: Local state management with type inference and explicit mutability. +icon: Variable +--- + +In Mist, variables follow the language-wide `type name` convention. For local scope, the `var` keyword provides type inference, while explicit types can be used for clarity or strictness. + +## Basic Declaration + +Variables are declared using the `var` keyword for automatic type inference. Like Rust, variables are immutable by default. + +```java +var message = "Hello Mist"; // Inferred as str* +var count = 42; // Inferred as i32 +``` + +## Mutability + +To allow a variable to be reassigned, use the `mut` modifier after the `var` keyword or the explicit type. + +```rust +var mut score = 0; +score = 100; + +f32 mut price = 19.99; +price = 14.99; +``` + +## Explicit Typing + +While `var` handles inference, you can explicitly define the type before the identifier. This is often used for clarity in complex logic or when the specific numeric width (e.g., `u8` vs `i32`) matters. + +```rust +u64 large_id = 1000234; +bool is_active = true; +``` + +## Constants + +Constants are immutable values that are evaluated at compile time. They require an explicit type and follow the `const` keyword. + +```rust +const i32 MAX_RETRIES = 5; +const str* VERSION = "1.0.4"; +``` + +## Key Characteristics + +- **Predictable Order**: Whether using `var` or an explicit type, the name of the variable always follows the "source" of its data. +- **Safety First**: Immutability by default prevents accidental state changes, mapping directly to Rust's memory safety model. +- **Zero-Cost Inference**: Type inference is handled entirely at compile time, ensuring there is no runtime performance penalty. +- **Shadowing**: Mist supports variable shadowing, allowing you to reuse variable names within the same scope to transform data without changing mutability. diff --git a/content/docs/meta.json b/content/docs/meta.json index 1fa753c..12568b0 100644 --- a/content/docs/meta.json +++ b/content/docs/meta.json @@ -14,8 +14,8 @@ "components/pointers-references", "---[ArrowDownUp]Logic---", - "variables", - "control-flow", - "match-patterns" + "logic/variables", + "logic/control-flow", + "logic/match-patterns" ] } \ No newline at end of file From f6189e3fa2a4cd3587ca4f41d3b12b5aa8df56b6 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:30:23 +0200 Subject: [PATCH 16/24] Contrl flow --- content/docs/logic/control-flow.mdx | 93 +++++++++++++++++++++++++++++ content/docs/logic/variables.mdx | 12 ++++ 2 files changed, 105 insertions(+) create mode 100644 content/docs/logic/control-flow.mdx diff --git a/content/docs/logic/control-flow.mdx b/content/docs/logic/control-flow.mdx new file mode 100644 index 0000000..6814709 --- /dev/null +++ b/content/docs/logic/control-flow.mdx @@ -0,0 +1,93 @@ +--- +title: Control Flow +description: Directing execution with expression-based logic, pattern matching, and traditional loop structures. +icon: Split +--- + +Control flow in Mist provides a bridge between C-style procedural logic and Rust's expression-oriented design. While many structures can return values, they follow a strict syntax for blocks and statements. + +## Conditionals + +The `if` statement evaluates a boolean expression. It supports multiple `else if` branches and an optional `else` block. + +```cpp +if (score > 50) { + println!("Pass"); +} else if (score == 50) { + println!("Borderline"); +} else { + println!("Fail"); +} +``` + +## Match + +The `match` statement provides exhaustive pattern matching. Currently, every match arm requires a block `{}` following the `=>` operator. + +```cpp +match (task_state) { + TaskState::Pending => { + println!("Queued"); + } + TaskState::Failed { reason, code } => { + println!("Error {}: {}", code, reason); + } + _ => { + println!("Other state"); + } +} +``` + +## Loops + +Mist supports both functional iteration and traditional low-level loop control. + +### C-Style For Loop + +For manual iteration control, Mist supports the standard three-part `for` loop: initialization, condition, and post-iteration statement. + +```cpp +for (var mut i = 0; i < 10; i = i + 1;) { + println!("Index: {}", i); +} +``` + +### For-In Loop + +The `for-in` loop iterates over collections or iterators using Mist's pattern matching system. + +```cpp +for (var item in collection) { + process(item); +} + +// Destructuring within the loop +for ((i32 x, i32 y) in coordinates) { + draw_point(x, y); +} +``` + +### While Loop + +The `while` loop continues execution as long as the parenthesized expression evaluates to `true`. + +```cpp +while (active) { + wait_for_event(); +} +``` + +## Jump Statements + +Execution flow can be interrupted or redirected using standard jump keywords. + +- **`return`**: Exits the current function, optionally passing back a value. +- **`break`**: Terminates the innermost looping construct. +- **`continue`**: Skips the remainder of the current loop iteration and proceeds to the next. + +## Key Characteristics + +- **Pattern Integration**: Loops and match arms utilize Mist's pattern system, allowing for seamless data destructuring during iteration. +- **Explicit Scoping**: Match items currently require explicit blocks, ensuring clear boundaries for variable shadowing and local logic. +- **Familiar Iteration**: The inclusion of C-style `for` loops provides fine-grained control for performance-critical logic where simple iteration is insufficient. +- **Rust-Native Safety**: Despite the procedural syntax, these structures compile to safe Rust, maintaining exhaustive checking and memory safety. diff --git a/content/docs/logic/variables.mdx b/content/docs/logic/variables.mdx index 90dbe1f..2f020a2 100644 --- a/content/docs/logic/variables.mdx +++ b/content/docs/logic/variables.mdx @@ -36,6 +36,18 @@ u64 large_id = 1000234; bool is_active = true; ``` +## Pattern Destructuring + +Because variable declarations are patterns, you can destructure tuples or structures directly. This keeps data extraction clean and avoids manual indexing. + +```rust +// Destructuring a tuple into local variables +(i32, i32) (x, y) = get_coordinates(); + +// Using 'var' within a pattern for inference +(String, i32) (name, age) = get_user_info(); +``` + ## Constants Constants are immutable values that are evaluated at compile time. They require an explicit type and follow the `const` keyword. From 7e53348b886f9948a81fd6e7c70b0b928b004dd6 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:36:18 +0200 Subject: [PATCH 17/24] Expressions --- content/docs/logic/expressions.mdx | 83 ++++++++++++++++++++++++++++++ content/docs/meta.json | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 content/docs/logic/expressions.mdx diff --git a/content/docs/logic/expressions.mdx b/content/docs/logic/expressions.mdx new file mode 100644 index 0000000..3799efc --- /dev/null +++ b/content/docs/logic/expressions.mdx @@ -0,0 +1,83 @@ +--- +title: Expressions +description: The building blocks of logic, from literals to complex postfix chains. +icon: Binary +--- + +Expressions in Mist are the fundamental units that evaluate to a value. The syntax follows a clean **prefix → primary → postfix** chain, providing a predictable structure that maps closely to Rust's mental model. + +## Primary Expressions + +Primary expressions are the starting point of any logic chain. These include literal values, paths to static members, or grouped expressions in tuples. + +```java +// Literals and paths +var x = 42; +var y = Math::PI; + +// Tuples +var coordinates = (10, 20, 30); + +``` + +## Postfix Operations + +Postfix expressions allow you to build on a primary value. This includes calling functions, accessing fields, indexing arrays, or initializing structs. + +```java +// Field access and method/function calls +var len = list.length(); + +// Struct initialization +var task = Task { + name: "Drafting", + priority: 1, +}; + +// Indexing and Macro calls +var first = items[0]; +println!("Value: {}", first); // Macro call via '!' + +``` + +## Prefix Operations + +Prefixes modify the primary expression that follows them. Mist uses these for logical negation, dereferencing, and creating references. + +```java +var mut value = 10; + +var ref = &value; // Reference +var mref = &mut value; // Mutable reference +var val = *ref; // Dereference +var is_false = !true; // Logical NOT + +``` + +## Binary Operations + +Binary operations are applied as postfixes to an expression, following a `bin_op ~ expr` pattern. This supports all standard arithmetic, comparison, and logical operators. + +```java +var sum = 10 + 20; +var is_equal = (x == y); +var complex = (a + b) * (c / d); + +``` + +## Operator Table + +Mist supports the following binary operators for comparisons and arithmetic: + +| Category | Operators | +| -------------- | -------------------------------- | +| **Arithmetic** | `+`, `-`, `*`, `/`, `%` | +| **Comparison** | `==`, `!=`, `<`, `>`, `<=`, `>=` | +| **Logical** | `&&`, `\|\|` | + +## Key Characteristics + +- **Predictable Chaining**: The `prefix* ~ primary ~ postfix*` grammar ensures that complex expressions are parsed consistently, whether you are dereferencing a function call or indexing a struct field. +- **Rust-Style References**: While the pointer syntax `type*` is used in declarations, expressions use `&` and `&mut` to create references, maintaining compatibility with Rust's borrow checker. +- **Macro Integration**: Macros are treated as a postfix operation (`!`), allowing them to be called on identifiers just like standard functions. +- **Unified Tuples**: Tuples are primary expressions, allowing them to be passed, returned, or destructured seamlessly within the expression tree. diff --git a/content/docs/meta.json b/content/docs/meta.json index 12568b0..cce9b65 100644 --- a/content/docs/meta.json +++ b/content/docs/meta.json @@ -16,6 +16,6 @@ "---[ArrowDownUp]Logic---", "logic/variables", "logic/control-flow", - "logic/match-patterns" + "logic/expressions" ] } \ No newline at end of file From 9832275f45e13a2260ac9b95f73daf16bf81f739 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:40:16 +0200 Subject: [PATCH 18/24] Fixed landing page code --- src/app/(home)/page.tsx | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx index 7886f23..161aa5a 100644 --- a/src/app/(home)/page.tsx +++ b/src/app/(home)/page.tsx @@ -73,24 +73,12 @@ public class PluginRegistry { self.prefix = prefix.to_string(); } - public void log(self*, LogLevel level, str* message) { - match(level) { - LogLevel::Info => { - println!("{level} {} {}", self.prefix, message); - } - - LogLevel::Warning => { - println!("{level} {} {}", self.prefix, message); - } - - LogLevel::Error => { - println!("{level} {} {}", self.prefix, message); - } - } + void log(self*, LogLevel level, str* message) { + println!("{level} {} {}", self.prefix, message); } impl fmt::Display { - fmt::Result fmt(self*, std::fmt::Formatter<'_> mut* f) { + std::fmt::Result fmt(self*, std::fmt::Formatter<'_> mut* f) { return write!(f, "logger ({})", self.prefix); } } From bd9a01491aeacb3640da8d6f175e2c3e38e95175 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 03:59:04 +0200 Subject: [PATCH 19/24] Landing lage scroll snapping --- src/app/(home)/Home.css | 16 +++++++++++ src/app/(home)/page.tsx | 63 ++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 src/app/(home)/Home.css diff --git a/src/app/(home)/Home.css b/src/app/(home)/Home.css new file mode 100644 index 0000000..6dc6217 --- /dev/null +++ b/src/app/(home)/Home.css @@ -0,0 +1,16 @@ +/* Force the body to never scroll */ +html, body { + overflow: hidden; + height: 100%; + margin: 0; + padding: 0; +} + +/* Optional: Hide scrollbar track for a cleaner UI while keeping functionality */ +.no-scrollbar::-webkit-scrollbar { + display: none; +} +.no-scrollbar { + -ms-overflow-style: none; + scrollbar-width: none; +} \ No newline at end of file diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx index 161aa5a..d124b68 100644 --- a/src/app/(home)/page.tsx +++ b/src/app/(home)/page.tsx @@ -6,6 +6,8 @@ import Link from "next/link"; import { useEffect, useRef, useState } from "react"; import { motion, Variants } from "framer-motion"; +import "./Home.css"; + const MotionLink = motion(Link); export const mistShowcase = [ @@ -140,7 +142,7 @@ function ShowSection({ return ( -
-
+ /* + 1. Move overflow-y-auto and snap-y to the ROOT div. + Now the entire screen is the scrollable "track". + */ +
+ {/* + THE RIGHT SIDE (MorphCode) + Using 'sticky' instead of 'fixed'. It will stay pinned to the + top/center while you scroll through the sections. + */} +
+
- + {/* + We use a key here to help React/Framer distinguish + morphing vs unmounting if needed + */} +
-
-
- {mistShowcase.map((show) => ( - - ))} -
+ {/* + THE SECTIONS + They now live in the main scroll flow. + */} +
+ {mistShowcase.map((show) => ( + + ))}
-
- {/*
- -
*/} + + {/* Scroll Indicator - Use fixed so it stays relative to screen */} Date: Tue, 12 May 2026 04:00:56 +0200 Subject: [PATCH 20/24] remove morph code on mobile --- src/app/(home)/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx index d124b68..2d1ec2a 100644 --- a/src/app/(home)/page.tsx +++ b/src/app/(home)/page.tsx @@ -200,7 +200,7 @@ export default function HomePage() { Using 'sticky' instead of 'fixed'. It will stay pinned to the top/center while you scroll through the sections. */} -
+
Date: Tue, 12 May 2026 04:04:17 +0200 Subject: [PATCH 21/24] Improved scrolling --- src/components/Morph.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Morph.tsx b/src/components/Morph.tsx index 788ba5d..14944a5 100644 --- a/src/components/Morph.tsx +++ b/src/components/Morph.tsx @@ -39,7 +39,7 @@ export default function MorphCode({ code, lang = "rust" }: Props) { }, [code, lang]); return ( -
+    
       
         
           {lines.map((line, lineIndex) => (

From fb362f65c4ed65fb67cc3341110e525799eb20bf Mon Sep 17 00:00:00 2001
From: Klesti Selimaj 
Date: Tue, 12 May 2026 04:28:36 +0200
Subject: [PATCH 22/24] Fixed scrolling

---
 src/app/(home)/Home.css   |  9 ---------
 src/app/(home)/layout.tsx | 15 +++++++++++----
 src/app/(home)/page.tsx   | 24 +++---------------------
 3 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/src/app/(home)/Home.css b/src/app/(home)/Home.css
index 6dc6217..29e205f 100644
--- a/src/app/(home)/Home.css
+++ b/src/app/(home)/Home.css
@@ -1,12 +1,3 @@
-/* Force the body to never scroll */
-html, body {
-  overflow: hidden;
-  height: 100%;
-  margin: 0;
-  padding: 0;
-}
-
-/* Optional: Hide scrollbar track for a cleaner UI while keeping functionality */
 .no-scrollbar::-webkit-scrollbar {
   display: none;
 }
diff --git a/src/app/(home)/layout.tsx b/src/app/(home)/layout.tsx
index 77379fa..de2e48a 100644
--- a/src/app/(home)/layout.tsx
+++ b/src/app/(home)/layout.tsx
@@ -1,6 +1,13 @@
-import { HomeLayout } from 'fumadocs-ui/layouts/home';
-import { baseOptions } from '@/lib/layout.shared';
+import { HomeLayout } from "fumadocs-ui/layouts/home";
+import { baseOptions } from "@/lib/layout.shared";
 
-export default function Layout({ children }: LayoutProps<'/'>) {
-  return {children};
+export default function Layout({ children }: LayoutProps<"/">) {
+  return (
+    
+      {children}
+    
+  );
 }
diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx
index 2d1ec2a..2ab2049 100644
--- a/src/app/(home)/page.tsx
+++ b/src/app/(home)/page.tsx
@@ -190,37 +190,20 @@ export default function HomePage() {
   const [currentText, setCurrentText] = useState(mistShowcase[0]?.code || "");
 
   return (
-    /* 
-       1. Move overflow-y-auto and snap-y to the ROOT div. 
-       Now the entire screen is the scrollable "track".
-    */
-    
- {/* - THE RIGHT SIDE (MorphCode) - Using 'sticky' instead of 'fixed'. It will stay pinned to the - top/center while you scroll through the sections. - */} -
-
+
+
+
- {/* - We use a key here to help React/Framer distinguish - morphing vs unmounting if needed - */}
- {/* - THE SECTIONS - They now live in the main scroll flow. - */}
{mistShowcase.map((show) => ( - {/* Scroll Indicator - Use fixed so it stays relative to screen */} Date: Tue, 12 May 2026 04:35:00 +0200 Subject: [PATCH 23/24] Updated philosphy --- content/docs/philosophy.mdx | 51 +++++++++++++++---------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/content/docs/philosophy.mdx b/content/docs/philosophy.mdx index e5d7977..a555e5d 100644 --- a/content/docs/philosophy.mdx +++ b/content/docs/philosophy.mdx @@ -1,52 +1,43 @@ --- title: Philosophy -description: Discover the philosophy and architecture behind Mist. +description: The mindset, ergonomics, and feeling of writing Mist. icon: Brain --- -**Mist** is a systems programming language that compiles directly into Rust. +**Mist** is a systems programming language designed for those who value the "craft" of software. It is built to provide a serene, tactile authoring environment that stays out of your way, allowing you to focus entirely on the architecture of your solution. -It was designed to make high-performance development feel more direct and less mentally taxing, without compromising on the safety, performance, or ecosystem richness that Rust provides. - -Mist is not a replacement for Rust. Instead, it serves as a more ergonomic surface layer for writing Rust-compatible systems code. It allows you to focus on the "what" while the compiler handles the "how" of idiomatic Rust generation. +By compiling directly to Rust, Mist offers a refined surface layer that maintains industrial-grade safety and performance while prioritizing a flow state that is often lost in modern systems development. --- -## Philosophy: Systems Programming, Refined +## The Philosophy of Ergonomics -Mist is built on the belief that systems programming should feel **calm, predictable, and easy to reason about**. +Writing Mist should feel intentional and deeply satisfying. It is built on the belief that systems programming is at its best when it is **calm, predictable, and direct**. -When working close to the metal, developers must balance performance, correctness, and structure. As projects scale, the "expression overhead"—the mental energy required to satisfy complex syntax—often creates friction. Mist reduces this friction by: - -* **Focusing on Flow:** Code should feel direct to write and require minimal "re-contextualization" when revisited months later. - - -* **Reducing Mental Friction:** By simplifying the surface syntax, your attention stays on solving the problem, not fighting the mechanics of expression. - - -* **Predictable Abstractions:** Every feature in Mist is designed to be transparent, ensuring you always understand the underlying system behavior. +### Reducing Expression Overhead +Complexity often arises from "expression overhead"—the mental energy spent navigating intricate syntax and symbols. Mist reduces this friction by: +* **Predictable Flow:** By adopting a consistent `type name` convention, code follows a natural rhythm that is easy to write and instantly scannable. +* **Structural Clarity:** Features like unified `class` blocks and explicit `constructor` keywords provide a clear, organized home for your logic, reducing the need to jump between disparate files or implementation blocks. +* **Tactile Precision:** Every symbol, from `mut*` pointers to pattern-based variables, is designed to feel physically connected to the data it represents, making the "mechanics" of the language feel like a well-calm tool in your hand. --- -## What Mist Is +## A Transparent Surface Layer -Mist is a compiled-to-Rust language specifically engineered for developers who need Rust's power but want a leaner authoring experience. +Mist is not a replacement for Rust; it is a **ergonomic interface** for it. It provides a way to interact with the world’s most powerful systems model through a cleaner lens. -### Key Characteristics: +* **Zero-Cost Abstractions:** Every high-level structure in Mist—whether it’s a class, an enum variant, or a trait implementation—maps directly to an optimized Rust primitive. There is no "magic," no hidden runtime, and no garbage collector. +* **Grounded Safety:** Mist doesn't hide memory safety; it makes it easier to express. You retain the full power of the borrow checker, but with a syntax that feels like a classic, high-performance toolkit. +* **Native Fluency:** Because Mist compiles to idiomatic, readable Rust, it is a first-class citizen of the ecosystem. You can utilize any existing crate while writing code that feels uniquely "Mist". -* **Native Ecosystem Integration:** Mist integrates directly with Cargo and existing Rust crates. +--- +## Why Mist? -* **Idiomatic Output:** It compiles into clean, readable Rust code rather than opaque machine logic. +Mist is for the developer who needs the rigor of a systems language but wants the comfort of a modern, streamlined environment. - -* **Zero-Cost Performance:** There is no runtime, no garbage collector, and no performance penalty. - - -* **Grounded Safety:** Mist remains fully powered by Rust’s type system and execution model. - - - -Mist is especially valuable for large-scale codebases where readability is paramount, but the strict guarantees of a systems language are non-negotiable. \ No newline at end of file +* **Mental Longevity:** Designed for large-scale codebases where readability is paramount to long-term maintenance. +* **Direct Control:** You stay close to the metal, but the language handles the "noise" of idiomatic expression. +* **Craftsmanship:** Mist is where the discipline of systems programming meets the comfort of a high-end workshop. From d82fad745796cef4db735595bdb90415552c102e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 12 May 2026 04:36:31 +0200 Subject: [PATCH 24/24] Dockerfile --- Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8770e18 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# Stage 1: Build the application +FROM node:20-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# Stage 2: Serve the static files with Nginx +FROM nginx:alpine +# Copy the build files from the builder stage to the Nginx web directory +COPY --from=builder /app/dist /usr/share/nginx/html +# Expose port 80 where the Nginx server runs +EXPOSE 80 +# Command to start Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file