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.4-alpha

Hardware Accelerated 3D Spatial Audio Post-Processing Stack Neural Pathfinding

vglib is Vyne's high-performance graphics, audio, and physics ecosystem. Engineered on a multi-threaded C++ backend, it bridges the gap between high-level Vyne scripting and raw hardware power.

Hybrid 2D/3D Pipeline

Seamlessly switch between native OpenGL 3D modes and high-speed texture rendering with Z-buffer support.

Shader Stack

Native GLSL support for Bodycam filters, VHS glitches, VHS-Color correction, and Volumetric Fog.

Nextbot AI (BETA)

Built-in vglib.pathfind() utilizing dynamic grid-avoidance for high-tension chase sequences.

Architect Suite

Native .dat map loader and OBJ exporter for modular level design and external engine porting.

selena_chase.vy (Bodycam AI implementation)
module vglib;
module vaudio;
module vmath;

# Initialize high-end bodycam environment
vglib.init(1920, 1080, "Vyne Pro - Selena Nextbot", vglib.FULLSCREEN);
vhs_shader = vglib.load_shader("shaders/vhs.fs");
selena_tex = vglib.load_texture("assets/selena.jpg");

# Global AI State
bot_pos = [60.0, 1.8, 60.0];
walls = vglib.load_map("tau_map.dat");

while (vglib.running()) {
    cam_pos = vglib.get_pos(camera);
    
    # AI Neural Tick: Pathfind through modular walls
    res = vglib.pathfind(bot_pos, cam_pos, walls, 1.0);
    bot_pos[0] = bot_pos[0] + res[0] * 0.4;
    bot_pos[2] = bot_pos[2] + res[2] * 0.4;

    # 3D Render with VHS Post-Processing
    vglib.begin_texture_mode(screen_target);
        vglib.begin3d(cam);
            vglib.billboard(cam, selena_tex, bot_pos, 4.0, vglib.WHITE);
            through w :: walls -> loop {
                vglib.cube_texture(wall_tex, w[0], w[1], w[2], w[3], vglib.WHITE);
            }
        vglib.end3d();
    vglib.end_texture_mode();
}

Module Reference: vglib

Method Parameters Description
vglib.load_map(path) string Parses .dat files and returns an array of modular world blocks.
vglib.pathfind(start, target, map, size) list, list, array, float Native AI routine for obstacle avoidance in modular environments.
vglib.billboard(cam, tex, pos, size) ptr, ptr, list, float Renders a 2D texture always facing the camera (Ideal for Nextbots).
vglib.check_collision_map(pos, size, map) list, list, array Iterates through world data for high-speed AABB sliding collision.
vglib.export_obj(map, filename) array, string Bakes modular world data into a standard 3D mesh (OBJ format).

Technical Constants

Constant Type Value / Mapping
vglib.VSYNC System 0x00000040 - Synchronization Hint
vglib.LEFT_SHIFT Input 340 - Standard Sprint Mapping
vglib.CYAN Color 0x00AAFFFF - Vyne Standard Branding Color

Vyne Builder (CLI)

SDK Tooling

Vyne includes a native deployment tool designed to package your projects into standalone, distributable environments. The builder automatically resolves dependencies, bundles assets, and generates bootstrap scripts.

Automated Bundling: The builder performs a static scan of your source code to identify and collect all referenced textures, sounds, shaders, and data maps.

Usage

Execute the builder via the primary compiler CLI using the -b flag.

terminal
# Synthesizing a standalone release qovluğu
./vynec.exe --build-game main.vy

Deployment Pipeline

When vynec -b is invoked, the engine executes the following high-speed deployment sequence:

Phase Action Output
1. Workspace Init Creates a dynamic output directory based on script name. /main_release/
2. Binary Injection Copies vynec.exe and urage.dll to the root. Engine Binaries
3. Asset Discovery Regex-based scanning of strings for .png, .wav, .fs, .dat, etc. Virtualized Assets
4. Bootstrap Generation Writes a run.bat to handle interpreted execution. Executable Script
Pro Tip: Ensure your asset paths are relative to the project root. The builder recreates the entire sub-directory structure inside the release folder to maintain VFS (Virtual File System) integrity.