Skip to content

Latest commit

 

History

History
155 lines (127 loc) · 6.33 KB

File metadata and controls

155 lines (127 loc) · 6.33 KB

Welcome to LayerScript: The Principle of Most Speed

LayerScript is an experimental, bare-metal systems programming language designed for hyper-aggressive optimization. Rather than translating sequential code directly into instructions, LayerScript models your program as a Partially Ordered Multiset (POMSET) of traces subject to logical constraints. If a value or operation does not affect the program's Observability Boundary, the compiler is free to compile it away, dissolve it into registers, or fold it entirely at compile-time.


🗺️ Documentation Sitemap

Explore the technical details of the LayerScript Language:

📖 Language Specification

🧩 Type System and Coercions

⚙️ Compiler Mechanics

🚀 Execution Model

🔧 Bare Metal Interfacing

🛠️ API and Standard Library

📚 Tutorials and Examples


⚡ Syntax Cheat Sheet (New LayerScript)

// 1. Bit-Precise and Refined Types
var age: u32 = 25;         // Unsigned 32-bit scalar
var mut delta: i8 = -1;    // Signed 8-bit mutable scalar
var flags: b16 = 0xFFFF;   // Raw 16-bit vector

// Refined parameters: Index must be mathematically proven < length N
function safe_read<T, N: usize>(arr: T*, idx: usize where idx < N) -> T {
    return arr[idx];       // Compiles with zero bounds-checking!
}

// 2. Types as First-Class Values
function IntOrFloat(is_float: bool) -> type {
    match is_float {
        true => return f32,
        false => return i32,
    }
}
var value: IntOrFloat(true) = 1.5;

// 3. Variable Hooks
var health: f64 = 100.0 {
    on_change: function(new, old) -> f64 {
        if new < 0 { return 0; }
        return new;
    }
}

// 4. Hardware Mapping
packed struct RegisterState {
    rax: b64,
    rbx: b64,
}

🎯 Language Architecture

graph TD
    A[LayerScript Language] --> B[Language Spec]
    A --> C[Type System]
    A --> D[Compiler]
    A --> E[Execution]
    A --> F[Bare Metal]
    A --> G[API/Stdlib]
    A --> H[Glossary]
    
    B --> B1[Syntax]
    B --> B2[Types]
    B --> B3[Variables + Hooks]
    B --> B4[Control Flow]
    B --> B5[Functions]
    B --> B6[Layer System]
    B --> B7[Modules + Namespaces]
    B --> B8[Traits + Overloading]
    B --> B9[Pattern Matching]
    
    C --> C1[Coercions]
    C --> C2[Refined Types]
    C --> C3[Type Storage + Inheritance]
    
    D --> D1[Parser/Lexer]
    D --> D2[Constraints/Z3]
    D --> D3[Observability]
    D --> D4[Type Checking]
    
    E --> E1[POMSET]
    E --> E2[layertrace]
    E --> E3[Hooks Runtime]
    
    F --> F1[Havoc]
    F --> F2[Interrupt]
    F --> F3[Memory Layout]
    F --> F4[FFI]
    
    G --> G1[Core Library]
    G --> G2[Runtime API]
    G --> G3[Built-in Types]
    G --> G4[CLI Reference]
Loading