DISCLAIMER: This repository is currently under active maintenance. This README serves as a live technical manifest and personal scratchpad for engine development.
Vyne is currently in its early stages but already supports a robust set of core programming constructs, specialized for terminal-based logic and ASCII manipulation.
| Feature | Syntax Example | Description |
|---|---|---|
| Arithmetic | (+, -, *, /, <, >, ==) |
Standard mathematical and comparison operators. |
| Bitwise | (&&, ||) |
Low-level bit manipulation for flags and binary data. |
| Functions | sub calculate(x) { ... } |
Defined using the sub keyword with scoped arguments. |
| Logic Flow | if cond { ... } |
Standard conditional branching. |
| Loops | while cond { ... } |
Standard iteration for repeated execution logic. |
| Scoping | group Graphics { ... } |
Encapsulate logic and variables into named namespaces. |
| Modules | module vcore |
Interfaces with native C++ libraries and system resources. |
Vyne employs a hybrid type system that supports both Explicit Declaration and Inferred Typing. This allows for flexible scripting while maintaining the safety required for complex logic.
| Mode | Syntax Example | Description |
|---|---|---|
| Inferred | score = 95 |
Type is determined at runtime based on the assigned value. |
| Explicit | age :: Number = 30 |
The variable is "locked" to a specific type; future assignments must match. |
| Constant | const PI = 3.14 |
Immutable binding. Reassignment attempts will trigger a Runtime Error. |
Vyne recognizes the following core types during explicit declaration:
Number: 64-bit floating point (handles both integers and decimals).String: UTF-8 encoded character sequences.Boolean: Logicaltrueorfalse.Array: Dynamic list ofValueobjects.
To ensure engine stability, the following rules are enforced:
[ Note: Type Mismatch ] If a variable is declared as
val :: Number, assigning aStringto it later will result in aType Error.
[ Note: Constant Protection ] Constants must be initialized at the moment of declaration. Once set, they are read-only for the duration of the program execution.
Vyne leverages native C++ modules to handle high-performance tasks that the interpreter shouldn't do alone.
- π‘ vcore System-level utilities, sleep timers, and process management.
- π¨ vglib The "Vyne Graphics Library" β home to the 3D ASCII donut and buffer management (in the future).
- π§ vmem Memory management and introspection β track heap usage, inspect raw memory addresses, and monitor variable footprints.
- π§ͺ vmath A comprehensive wrapper for the C++ standard math library, featuring trigonometric functions, hyperbolic operations, and mathematical constants like
$\pi$ and$\phi$ .
out(x) # Print to terminal
type(x) # Returns "number", "string", "array", or "function"
sizeof(x) # Get length of strings or count of array elements
string(x) # Convert any data type to string
number(x) # Convert any data type to number
sequence(x, y) # Generates a sequence ( array ) in given range of numbersArrays in Vyne are dynamic and come with built-in methods for data manipulation:
arr.push(val)/arr.pop()β Stack operations.arr.delete(val)β Remove specific elements.arr.sort()β In-place numeric sorting.arr.reverse()β Flip array order.arr.place_all(val, count)β Bulk initialize an array.arr.clear()β Wipe all data from the instance.
To build the interpreter from source, clone the repository and compile using your preferred C++ compiler:
git clone https://github.com/tuncaygafarli/vyne.git
cd vyne
./build.bat # For Windows
./build.sh # For LinuxVyne's engine architecture is fully documented using Doxygen. This allows you to explore the interpreter's internals through a searchable web interface, complete with class diagrams and function call graphs.
To build the documentation locally, ensure you have Doxygen and Graphviz installed, then run:
doxygen DoxyfileOnce the process finishes, open the following file in your browser:
vyne-docs/html/index.html
The documentation provides several powerful ways to understand how Vyne works:
-
Abstract Syntax Tree (AST) Hierarchy: Navigate to
Classes -> Class Hierarchy. This visualizes how every language feature (likeWhileNode,BinOpNode, orFunctionNode) inherits from the baseASTNode. -
Collaboration Diagrams: Each class page features a diagram showing which other objects it depends on. For example, you can see how an
AssignmentNodeinteracts with theSymbolContainer. -
Function Call Graphs: Every
evaluate()method includes a flowchart showing which sub-functions are called during execution. This is extremely helpful for tracing how the interpreter processes complex Vyne scripts. -
Native Module Bindings: Explore the
modulesnamespace to see the C++ implementation ofvglib(the donut renderer) andvcore. You can view the raw C++ math directly alongside the documentation.
vyne/compiler: The Lexer and Parser that turn source code into an AST.vyne/core: The main execution engine and theValuesystem.vyne/modules: Native C++ extensions that provide high-performance features to the language.