v0.0.2-alpha

The Vyne Programming Language

Vyne is a hybrid interpreted language engineered for performance-critical algorithm testing and low-level memory control. Designed in Baku, it provides a clean, C-style syntax with advanced functional primitives.

Vyne code is executed line-by-line via a high-performance C++ backend, bridging the gap between high-level logic and native execution.

Engine Rulesets

Vyne allows you to configure engine behavior at runtime using the ruleset block.

config.vy
ruleset {
    warnings,       # Enable/Disable semantic warnings
    dynamic_casting # Control strictness of type conversions
};

Types & Variables

Vyne supports both implicit inference and strict explicit typing using the :: operator.

Type Declaration Example Description
Int64 a :: Int64 = 42; 64-bit signed integer.
Float64 x :: Float64 = 3.14; Double precision floating point.
Array list :: Array = [1, 2, 3]; Dynamic list with native methods.
String s :: String = "Vyne"; UTF-8 compatible strings.

Control Flow & Logic

Vyne provides standard imperative control structures alongside advanced functional iteration patterns.

Conditionals (If/Else)

Vyne uses standard if, else if, and else blocks. Braces are mandatory for clarity.

logic.vy
score :: Int64 = 85;

if score >= 90 {
    out("Grade: A");
} else if score >= 80 {
    out("Grade: B");
} else {
    out("Grade: F");
}

Iterative Loops

Standard while loops are used for condition-based iteration. You can use break to exit early.

while_loop.vy
i = 0;
while i < 100 {
    if i == 50 { break; }
    out(i);
    i++;
}

Advanced Iteration: through

The through operator is Vyne's signature feature for data processing. It transforms or filters collections natively.

[Image of data flowing through a filter and map process in programming]
Pattern Keyword Action
Mapping collect Transforms every element and returns a new array.
Filtering filter Returns only elements that meet a condition.
Deduplication unique Removes all duplicate values from the stream.
Standard loop Executes a block for each item without returning a value.
functional.vy
# Unique filter
raw_data = [1, 1, 2, 3, 3];
clean = through item :: raw_data -> unique;

# Fibonacci with through loop
through i :: 0..n -> loop {
    next = a + b;
    a = b;
    b = next;
};

Engine Control: ruleset

Unlike other languages, Vyne allows you to toggle engine-level features like warnings or dynamic_casting mid-script.

engine_config.vy
ruleset { 
    warnings: on, 
    dynamic_casting: off 
};

Iteration & Through Loops

While Vyne supports standard while loops, its true power lies in the through operator for functional-style data processing.

iteration.vy
# Standard While
while i < 10 { i++; }

# Through: Filter and Unique
y = [1, 1, 2, 2, 3];
uniques = through item :: y -> unique;

# Through: Collect (Map)
doubled = through x :: [10, 20] -> collect { x * 2 };

Functions

Functions in Vyne are first-class citizens. They support explicit type checking, type inference, and can be scoped to specific modules using the :: operator.

Note: Braces {} are mandatory for function bodies, and the return keyword is used to exit with a value.

Defining Functions

Vyne allows you to define functions with strict typing for parameters and return values, or you can let the engine infer the types dynamically.

functions.vy
# 1. Explicitly Typed Function
fn add(a :: Int64, b :: Int64) -> Int64 {
    return a + b;
}

# 2. Type Inference (Dynamic)
fn multiply(x, y) {
    return x * y;
}

# 3. Recursive Logic
fn factorial(n :: Int64) -> Int64 {
    if n <= 1 { return 1; }
    return n * factorial(n - 1);
}

Function Scoping (Namespacing)

To organize logic, you can bind functions directly to a module. This prevents naming collisions in large projects.

scoped_fn.vy
module MathUtils;

# Scoping a function to MathUtils
fn :: MathUtils square(x :: Int64) -> Int64 {
    return x * x;
}

out(MathUtils.square(7)); # Outputs: 49

Type Checking Table

Feature Syntax Behavior
Parameter Typing (var :: Type) Strict validation at call-time.
Return Type -> Type Ensures the returned value matches the signature.
Void Functions fn name() { ... } Implicitly returns a Null value if no return is present.
Recursion factorial(n-1) Fully supported with engine-level stack protection.

Interfaces & Methods

Interfaces in Vyne are more than just structs; they support methods with self reference and pointer-based relationships.

oop.vy
interface Node {
    kind :: Int64,
    data :: Int64, 
    left :: Node&,  # Reference type
    right :: Node& 

    isValid() {
        if self.data == 0 { return false; }
        return true;
    }
}

Modular Architecture

Organize large projects using module and group. Use deploy to expose namespaced logic to the global scope.

modules.vy
module physics;

group Constants :: physics {
    pi :: Float64 = 3.1415;
};

deploy physics;
out(Constants.pi);

Linear Algebra (vlinalg)

The vlinalg module provides high-level abstractions for vector spaces and matrix operations, leveraging Vyne's functional primitives for heavy numerical computations.

Performance Tip: Vyne uses internal pooling for matrix data arrays, making vlinalg ideal for MLP and Neural Network prototyping.

Defining Architectures

Use interface to define custom mathematical structures. The vlinalg.Types group includes standard definitions for Matrices and Vectors.

linear_types.vy
interface Vector {
    x :: Int64,
    y :: Int64,

    magnitude() -> Float64 {
        return vmath.sqrt(self.x * self.x + self.y * self.y);
    }
}

Matrix Operations

Vyne excels at matrix transformations by combining through loops with collect or loop patterns.

Operation Function Description
Addition vlinalg.add(a, b) Element-wise addition of two matrices.
Multiplication vlinalg.multiply(a, b) Standard dot product multiplication ($O(n^3)$).
Activation vlinalg.apply_sigmoid(m) Applies sigmoid function to all elements.
Transpose vlinalg.transpose(m) Swaps rows and columns.

Practical Usage: Matrix Multiplication

neural_net_snippet.vy
module vlinalg;
deploy vlinalg;

# Initialize a 2x2 Matrix
m1 = Types.Matrix(2, 2, [[1, 2], [3, 4]]);
m2 = Types.Matrix(2, 2, [[5, 6], [7, 8]]);

# Perform dot product
result = multiply(m1, m2);
out(result.data); # [[19, 22], [43, 50]]

VCore (System Standard)

The vcore module is the backbone of the Vyne runtime, providing essential utilities for I/O, process management, and environment introspection.

Method Signature Description
input (prompt) -> String Pauses execution and reads a line from stdin.
now () -> String Returns current system time in ISO format.
sleep (ms :: Int64) Blocks the current thread for specified milliseconds.
platform () -> String Returns OS and Architecture (e.g., "Windows x64").

System Properties

Runtime Data: Access internal engine metrics directly via static properties.
Property Type Description
vcore.pid Float64 The current Process ID.
vcore.memory_usage Float64 Physical memory (RSS) consumed by the engine in bytes.
vcore.version String Vyne engine semantic version.

VMath (Numerical Primitives)

Native C++ math implementations for heavy numerical tasks. vmath functions operate on 64-bit precision floats.

math_test.vy
module vmath;
deploy vmath;

val = sin(3.14 / 2); # Approx 1.0
active = sigmoid(0.5); # High-perf activation
rand_val = random(1, 100);

Function Index

Category Methods
Trigonometry sin, cos, tan, asin, acos, atan2
Calculus/Log sqrt, log, log10, exp, pow
Machine Learning sigmoid, relu, clamp
Rounding floor, ceil, round, abs

Mathematical Constants

Constant Value
vmath.pi $3.141592653589793$
vmath.e $2.718281828459045$
vmath.tau $6.283185307179586$
Low-Level Access

vmem (Memory Engine)

The vmem module provides native introspection and raw memory manipulation capabilities. It allows Vyne to behave as a systems-level tool for debugging heap structures.

God Mode: peek and poke bypass the safety of the Vyne runtime. Incorrect addresses will lead to a C++ segmentation fault.

Core Functions

Method Signature Description
usage () -> Int64 Returns the total deep-memory footprint in bytes.
addrOf (any) -> Int64 Returns the native memory address of a Vyne object.
peek (addr) -> any Reads a Value from a raw memory address.
poke (addr, val) Writes a Value directly to a memory address.

Example: Memory Manipulation

raw_access.vy
module vmem;
deploy vmem;

target = "Original";
addr = vmem.peek(target);

# Directly overwrite the value in memory
vmem.poke(addr, "Injected via vmem");

out(target); # Outputs: Injected via vmem

vglib v0.0.1-alpha

Hardware Accelerated Spatial Sound RTX Optimized

Vyne's official graphics and audio engine. Built on a Raylib backend, it provides high-performance 2D/3D rendering via low-level C++ matrix math and real-time digital signal processing.

3D Engine

Native Z-Buffer, Orbital Camera, and Matrix Transformation support.

Audio Pipeline

Seamless MP3/WAV streaming with dynamic gain and master volume control.

Input Mapping

Real-time key-state tracking with built-in hardware constant mapping.

shoegaze_engine.vy
import vglib;

# Initialize high-fidelity environment
vglib.init(1280, 720, "Vyne Pro Engine");
vglib.init_audio();
cam = vglib.camera();

# Asset Loading (Pointer-based)
riff = vglib.load_sound("assets/shoegaze.wav");
vglib.sound_volume(riff, 0.8);

while (vglib.running()) {
    vglib.begin();
    vglib.clear(vglib.BLACK);

    # 3D Render Block
    vglib.begin3d(cam);
        if (vglib.key_down(vglib.SPACE)) {
            # Apply rotation and color
            vglib.cube(0, 1, 0, 2, 45, vglib.CYAN);
            vglib.play_sound(riff);
        }
        vglib.grid(10, 1.0);
    vglib.end3d();

    vglib.text("FPS: 60", 20, 20, 20, vglib.GREEN);
    vglib.end();
}

Engine Constants

Category Constant Value / Purpose
Colors vglib.CYAN 0x00AAFFFF (Native RGBA)
Input vglib.SPACE Standard 32-bit Mapping
System vglib.version v0.0.1-alpha