Datara is a next-generation compiled systems and application programming language and compiler toolchain (forgen) written in Rust. Designed for high-frequency trading, cloud microservices, scientific computing, game engines, and native UI applications, Datara unites the syntax clarity and ergonomic velocity of modern languages with the mechanical sympathy, zero-cost abstractions, and predictable sub-millisecond execution of bare-metal C and Rust.
Datara completely eliminates garbage collection pauses and reference-counting cycles through deterministic scope-based affine ownership and zero-copy borrowing (view). It pioneers the Evidence Gate Optimizer, a formal verification pipeline where every optimization pass (SROA, Mem2Reg, Closed-Form LoopFold, CSE, Branchless Select) is backed by structural mathematical proof at the SSA intermediate representation (DMIR) level. Code generation is powered by a multi-target backend: Cranelift (with DWARF 4 line & debug info) for instant 30–50ms developer builds and JIT evaluation, LLVM AOT (--llvm) with Clang -O3 -flto for peak machine-speed deployment, and Capability-Native WebAssembly (--wasm) for zero-trust sandboxed browser and serverless runtimes.
Note
🇷🇺 Русскоязычная версия для всех: Руководство по Datara простыми словами — без сложного жаргона, с наглядными тестами, замерами скорости и условиями задач.
- Installation & Setup (Get Started in 60 Seconds)
- Complete Language Syntax & Mastery Guide
- Program Structure & Modules
- Modules, Visibility & Encapsulation (
pub,use,mod.dtr) - The Variable Triad (
let,mut,val) - Primitive & Compound Data Types
- Operators, Expressions & Bitwise Intrinsics
- Strings, Escapes & String Interpolation
- Control Flow: Conditionals, Loops & Branchless Logic
- Functions, Expression Bodies, UFCS & Pipelines
- Data-Oriented Programming (
class&behavior) - Polymorphic Traits & Inherent Implementations (
trait,impl) - Affine Ownership, Borrow Regions & Zero-Copy Views (
view) - Dual-Mode Ownership Fixpoint & Graduated Lowering
- Pattern Matching & Decision Control (
match,decide) - Deterministic Error Handling (
Result!,Option?,?,or) - Deterministic Resource Management (
with) - Multi-Core Data Concurrency (
parallel for) - Hardware SIMD Vector Primitives (
float4,int4,dot)
- Exhaustive Standard Library API Reference (All Modules)
stdlib.math(High-Precision & Bitwise Math)stdlib.text(High-Performance String Engine)stdlib.collections(ListWrapper<T>,MapWrapper<K, V>)stdlib.json(Zero-Dependency High-Speed Parser)stdlib.net&stdlib.http(Async Sockets & HTTP)stdlib.io&stdlib.sys(File System & System Clock)stdlib.crypto(SHA-256 & Cryptographic Primitives)stdlib.ui(Zero-JS Reactive Web & Native Windows)stdlib.database(Connection Pooling & SQL Drivers)stdlib.result(Result & Option Algebraic Utilities)stdlib.time(Monotonic High-Precision Clocks)stdlib.interop(C-ABI Foreign Function Bridge)
- Compiler Architecture, Evidence Gate Optimizer & Multi-Target Codegen (Cranelift, LLVM, Wasm)
- Compiler Ladder & Verification Flow
- Evidence Gate Formal Mathematical Fingerprinting
- SSA Optimization Passes: SROA, Mem2Reg, LoopFold, Select
- Dual Codegen Engine: Cranelift vs LLVM AOT
- DWARF 4 Native Debugging & Line Information
- Proof-Carrying Scheduler (PCS) & Deterministic Wavefronts
- Capability-Native WebAssembly Backend (
--wasm) - Continuous Integration & AddressSanitizer (ASan)
- Datara Performance & Optimization Matrix
- The Forgen Developer Tooling Ecosystem (DX Suite)
forgen run,build [--llvm],check,test,benchforgen domain&domain --llvm(Whole-Program Domain Specialization)forgen sae(Semantic Adaptation Engine Inspector)forgen profile(Static & Runtime Execution Profiler)forgen format(Official Formatter & Granular Flags)forgen repl(Zero-Latency Interactive JIT Console)forgen watch(50ms Instant Hot-Loop Live Reload)forgen clean(Deep Cache & Artifact Cleaner)forgen lint&forgen audit(Effect Lattice Security Auditor)forgen explain <code|rule>(Interactive Error Encyclopedia)forgen doc [--open](Autonomous Single-File SPA Generator)forgen tree [--effects](Dependency Hierarchy & Security Scanner)forgen why&forgen context(Semantic Optimization & Introspection API)forgen ui(Zero-JS Web & Native GUI Application Runner)forgen vendor&forgen update(Air-Gapped 100% Offline Builds)dpm(Package Manager, HTTP/Tarball Registry & Lockfile)forgen export(C99/C++ Header & Shared Library.dll/.so)forgen completions(Shell Autocomplete for PowerShell, Bash, Zsh, Fish)
- Specialized Systems Domains: Game Engines, Microcontrollers & OS Kernels
- Ecosystem Interoperability: Sparks Registry & Rust Bridge
- Datara Execution Tiers & Architecture
- Licensing & Community
Tip
Zero-Configuration & Zero-Dependency Guarantee:
All 33 official Standard Library modules (stdlib.math, stdlib.io.fs, stdlib.json, stdlib.crypto, stdlib.collections, stdlib.time, stdlib.net, etc.) are compiled directly into the binary as an in-memory fallback. You never need to manually download or configure them. External third-party packages are installed via the built-in package manager (dpm add <pkg>) or restored automatically via dpm install.
Download and run the official 1-click installer:
- Download Datara-Setup.exe (or run
dist/Datara-Setup.exefrom this repository)
What the installer does automatically:
- Native Windows GUI wizard with dark theme and official Datara icon.
- Installs
forgen.exe(compiler),datara.exe(runtime), anddpm.exe(package manager) into%LOCALAPPDATA%\Programs\Datara. - Installs all 33 official Standard Library modules.
- Associates
.dtrfiles with the official high-resolution Datara icon in Windows Explorer. - Adds Datara to your User
PATHand setsDATARA_HOME. - Registers Datara in Windows "Installed Apps" (with clean uninstaller).
- Installs the Datara Language Extension for VS Code / Cursor.
Open PowerShell and run:
irm https://raw.githubusercontent.com/waters1ze/datara/main/install.ps1 | iexOpen your terminal and run the official Unix installation script:
curl -fsSL https://raw.githubusercontent.com/waters1ze/datara/main/install.sh | bashDynamically detects your OS and architecture, downloads the latest release, installs forgen, datara, and dpm to ~/.datara/bin, sets up standard library, registers desktop MIME file icons (text/x-datara for GNOME/KDE/macOS Finder), and configures PATH in ~/.bashrc or ~/.zshrc.
Then reload your environment:
source ~/.bashrc # On Linux / Bash
# or
source ~/.zshrc # On macOS / ZshInstall and run Datara seamlessly across developer ecosystems:
Run Datara files or launch the REPL instantly with npx:
# Instant run with zero local installation:
npx @waters1ze/datara run main.dtr
# Interactive REPL:
npx @waters1ze/datara repl
# Global installation:
npm install -g @waters1ze/dataraInstall CLI runners and Python FFI bindings via pip:
pip install dataraUse as CLI (forgen, datara, dpm) or embed inside Python:
import datara
datara.run("algorithm.dtr")Compile and install the latest Forgen compiler directly from crates.io:
cargo install forgenInstall syntax highlighting, type hover, and icon themes in 1 command:
code --install-extension dist/datara-language-1.1.0.vsixInstall native system packages on Debian/Ubuntu or Fedora/RHEL:
# Debian / Ubuntu / Pop!_OS / Linux Mint:
sudo dpkg -i datara_1.1.0_amd64.deb
# Fedora / RHEL / CentOS / openSUSE:
sudo rpm -ivh datara-1.1.0-1.x86_64.rpmwinget install waters1ze.Datara
# or Scoop:
scoop install https://raw.githubusercontent.com/waters1ze/datara/main/packaging/scoop/datara.jsonbrew install waters1ze/tap/datara
# or Arch Linux:
yay -S datara-binRun Datara without installing anything locally via the official container image from GitHub Packages:
# Pull official image from GitHub Container Registry
docker pull ghcr.io/waters1ze/datara:latest
# Launch interactive REPL inside container
docker run -it --rm ghcr.io/waters1ze/datara:latest
# Build and run a local Datara file
docker run --rm -v ${PWD}:/workspace -w /workspace ghcr.io/waters1ze/datara:latest run main.dtrEvery release artifact and prebuilt package is cryptographically hashed with SHA-256. Verify file integrity before deployment:
# Linux / macOS:
sha256sum -c dist/SHA256SUMS.txt
# Windows PowerShell:
Get-FileHash Datara-Setup.exe -Algorithm SHA256The canonical checksum ledger is located at dist/SHA256SUMS.txt.
If you have Rust 1.80+ and Cargo installed:
git clone https://github.com/waters1ze/datara.git
cd datara
cargo build --release --bin forgenThe resulting native executable will be located at target/release/forgen (forgen.exe on Windows).
To run the automated local installer immediately after building:
- Windows:
.\install.ps1 - Linux / macOS:
./install.sh
Datara comes out-of-the-box with an official Language Server Protocol (LSP v3.17) implementation:
forgen lspConfigure your favorite editor (VS Code, Neovim, Zed, Sublime Text) to execute forgen lsp over stdio for .dtr and .forge files. Features supported:
- Instant syntax diagnostics and red error underlines.
- Automatic hover type inspection.
- Auto-completion for standard library modules and functions.
- Automatic formatting on save via
forgen format.
Universal IDE Setup Guide: For 30-second setup instructions for Visual Studio Code, Cursor, JetBrains (IntelliJ / CLion / PyCharm / RustRover), Neovim / Vim, Sublime Text, Helix, and Zed, see
editors/README.md.
Create a file named hello.dtr:
use stdlib.math
fn main() {
let language = "Datara"
let version = 1
out fmt"Welcome to {language} v{version}!"
let radius = 5.0
let area = 3.1415926535 * radius * radius
out fmt"Circle area: {area}"
}
Run it instantly:
forgen run hello.dtrExecution time: 35 ms from source code to native CPU execution!
Build a standalone, relocatable native binary:
# Default Cranelift fast native binary
forgen build hello.dtr
# Or peak whole-program optimization via LLVM (-O3 + LTO)
forgen build hello.dtr --llvmDatara includes 44+ verified examples and full-scale showcase projects located in examples/:
| Project / Showcase | Path | Description | Key Technologies |
|---|---|---|---|
| High-Speed JSON Parser | examples/showcase/json_parser/ |
Recursive descent JSON parser with full structural validation | Fast recursion, ADT enums, zero-copy view |
| Deterministic HTTP/1.1 Server | examples/showcase/http_server/ |
Low-latency HTTP/1.1 request router with JSON responses | Sockets, affine ownership, string slicing |
| Commit-Log Key-Value Storage Engine | examples/showcase/toy_kv/ |
Append-only storage engine with WAL replay and checksums | Disk I/O, binary serialization, error propagation |
| Multi-Core Lockstep Physics Sim | examples/showcase/lockstep_sim/ |
Deterministic physics simulation across parallel CPU workers | parallel for, float4 SIMD, Frame Arena |
| Zero-Copy Rust Ecosystem Bridge | examples/showcase/rust_bridge/ |
Bi-directional C-ABI interop with crates.io (image, regex, serde_json) |
dpm rust-bridge, Pointer + Int, panic barrier |
| Capability-Checked WebAssembly | examples/showcase/wasm_page/ |
Direct browser Wasm compilation with capability sidecar | --wasm, v128 SIMD, .capabilities.json |
| Deterministic SVG Chart Engine | examples/showcase/charts/ |
Standalone SVG data visualization generator | String templates, formatting, file I/O |
| Application | Path | Description | Architecture Tier |
|---|---|---|---|
datara_find |
examples/datara_find/ |
Multi-module file search tool with custom argument parser, file crawler, and colored output | Level 2 Multi-File Module |
real_cli |
examples/real_cli/ |
Production modular command-line utility with config loader and diagnostics | Level 2 Multi-File Module |
user_modules |
examples/user_modules/ |
Enterprise architecture demonstration with billing, core, security, and serialization modules | Cross-module behavior extension |
| File | Topic & Concept | Key Syntax |
|---|---|---|
01_hello_world.dtr |
Minimal program entry point, string printing |
fn main(), out
|
01_vertical_slice.dtr |
Functions, control flow, typed variables, arithmetic |
let, mut, if/else
|
02_math_and_loops.dtr |
Loop ranges and closed-form arithmetic optimization ($O(1)$) |
for i in 1..n, while
|
02_class_modern_oop.dtr |
Structured classes and object methods |
class, fn
|
03_post_oop_class.dtr |
Decoupled data layout with zero-vtable direct calls |
class, this.field
|
03_split_behavior.dtr |
Decoupled classes with external behavior extensions | behavior For Class |
04_decide_and_control.dtr |
Branchless functional decision matching | decide { cond => val } |
04_enum_adt.dtr |
Algebraic Data Types (tagged unions) with exhaustive matching |
enum, match
|
05_pipeline_dataflow.dtr |
High-performance Stream Fusion data pipelines |
|>, then
|
06_phase1_complete_app.dtr |
Multi-component integrated application | Modules, structs, pipelines |
07_entity_process_model.dtr |
Entity-Component-Role architecture |
role, component, then
|
08_text_analyzer_cli.dtr |
Text metrics, Coleman-Liau index, ASCII charts | String analysis, arrays |
09_error_propagation_question.dtr |
Monadic error propagation and recovery |
Result!, Option?, ?, or
|
09_matrix_math_cli.dtr |
3D linear algebra, Sarrus determinant, matrix trace | Fixed arrays, float math |
10_database_query_cli.dtr |
In-memory relational database with SQL-style queries | Filtering, mapping, aggregations |
11_crypto_pow_cli.dtr |
SHA-256 Proof-of-Work blockchain miner & Knuth hash | Cryptography, bitwise intrinsics |
12_dynamic_variables_val.dtr |
Variable Triad (let, mut, val) and gradual dynamic typing (mut val) |
let, mut, val, mut val
|
dynamic_guarded_demo.dtr |
Graduated runtime ownership acquire/release guards | Affine ownership fixpoint |
zero_js_dashboard.dtr |
Zero-JS reactive web and native GUI dashboard |
stdlib.ui, HTML5 generation |
Datara was designed around a central philosophy: "Say what you mean, prove what you execute." Syntax is clean, concise, and unambiguous, eliminating boilerplate without sacrificing systems-level control.
Every Datara program or library file consists of:
- Module imports (
use ...) - Type and class declarations (
class ...) - Behavior and method blocks (
behavior ...) - Function definitions (
fn ...)
use stdlib.math
use stdlib.collections
use stdlib.time
fn main() {
out "Program entry point"
}
Datara projects support three progressive complexity tiers:
- Level 1 (Scripting / Single-File): Just
forgen run file.dtr. Zero manifests or setup needed. - Level 2 (Folder Project): Any folder with a
main.dtr. Forgen auto-discovers all peer.dtrmodules without configuration. - Level 3 (Enterprise Application / Library): Initialized via
forgen init myapp. Containsdatara.toml,src/,tests/, andbenches/.
# Initialize a new structured project
forgen init my_service
# Multi-module file watcher (instant re-execution / test / check on file save)
forgen watch run
forgen watch test
forgen watch check
# Dependency updates from HyperGrid and Git sources (updates datara.lock)
forgen update # or: dpm update
# Cryptographic package verification against datara.lock
dpm verify
# Offline packaging (recursively vendors nested dependencies into vendor/)
forgen vendorDatara enforces explicit software architecture boundaries with a strict private-by-default encapsulation model:
All top-level definitions (classes, structs, functions, traits, behaviors, methods, and fields) are strictly private to their defining file/module unless explicitly qualified with pub:
// In module 'crypto':
pub struct KeyPair {
pub public_key: Str
private_seed: Str // Private field: invisible outside 'crypto'
}
pub fn generate_keys() -> KeyPair {
return KeyPair {
public_key: "0xabc...",
private_seed: "secret"
}
}
fn internal_hash(s: Str) -> Str { ... } // Private function: strictly module-internal
Attempting to reference, instantiate, or import a private item from another module is rejected at compile time:
error[E0042]: item 'internal_hash' is private to module 'crypto'
--> src/main.dtr:4:12
|
4 | let h = crypto::internal_hash("test")
| ^^^^^^^^^^^^^^^^^^^^^ item is private; declare as 'pub fn internal_hash' to expose
Modules are loaded hierarchically:
- File-Based:
use math_utilsresolvesmath_utils.dtrin the same directory or source path. - Directory-Based: If a subdirectory contains
mod.dtr(e.g.network/mod.dtr), importinguse networkresolves the folder package, usingmod.dtras the public export root. - Transitive Circular Import Prevention: The module resolver tracks active dependency expansion chains. Any circular reference cycle (
A -> B -> C -> A) is immediately halted at compile time with cycle trace diagnostics.
Unlike languages that conflate immutability, mutability, and dynamic re-binding, Datara enforces a strict Variable Triad:
| Keyword | Mutability | Type Dynamics | Reassignment | Performance / Optimizer Behavior | Primary Use Case |
|---|---|---|---|---|---|
let |
Immutable | Static | Forbidden (Compile-time error) | Directly promoted into CPU SSA registers via Mem2Reg | Constants, invariant calculations, pure pipelines |
mut |
Mutable | Type-Locked | Permitted (Must match declared static type) | Fast register/stack scalar; zero dynamic boxing overhead | Loop counters, state accumulators, algorithms |
val |
Immutable | Gradual Container | Forbidden without mut |
Static scalar promotion when value is known and constant | Schema constants, heterogeneous configuration |
mut val |
Mutable | Fully Dynamic (Val) |
Permitted (Any type at runtime) | Gradual dynamic container (Val variant box) |
Dynamic JSON ingestion, schema evolution, CLI payloads |
fn main() {
// ------------------------------------------------------------------------
// 1. 'let': Immutable Static Binding
// ------------------------------------------------------------------------
let max_connections: Int = 5000
let app_name = "HyperEngine"
// max_connections = 10000 // COMPILE ERROR: Cannot assign twice to immutable variable
// ------------------------------------------------------------------------
// 2. 'mut': Mutable, Strictly Type-Locked Variable
// ------------------------------------------------------------------------
mut active_workers: Int = 1
active_workers = active_workers + 7 // OK: Same type (Int)
// active_workers = "busy" // COMPILE ERROR: E-TYPE-001 (Type mismatch: expected 'Int', got 'String')
// ------------------------------------------------------------------------
// 3. 'val': Constant Gradual Dynamic Container
// ------------------------------------------------------------------------
val api_version = 2
// api_version = 3 // COMPILE ERROR: 'val' constants cannot be reassigned; use 'mut val'
// ------------------------------------------------------------------------
// 4. 'mut val': Gradual Dynamic Typing Container (`Val`)
// ------------------------------------------------------------------------
// The variable stays dynamically typed and can freely evolve across arbitrary
// types at runtime without compile-time type rejection!
mut val dynamic_payload = 100
out fmt"dynamic_payload as Int: {dynamic_payload}"
// Dynamically reassign to a String:
dynamic_payload = "now a dynamic string payload"
out fmt"dynamic_payload as Str: {dynamic_payload}"
// Dynamically reassign to a List:
dynamic_payload = [10, 20, 30]
out fmt"dynamic_payload as List: {dynamic_payload}"
// Explicit type annotation with 'Val' (Heterogeneous Variant Box):
let raw_config: Val = "arbitrary configuration string"
}
Design Principle: Go-style
:=is rejected by the compiler. If you writex := 10, the compiler halts with an exact caret and suggestslet x = 10ormut x = 10.
Datara provides platform-independent, fixed-width primitive types:
| Type | Size | Description | Example |
|---|---|---|---|
Int / Int64 |
64-bit | Signed two's-complement integer | let x: Int = -42 |
Int32 |
32-bit | Signed 32-bit integer | let i: Int32 = 1000 |
Int16 |
16-bit | Signed 16-bit integer | let s: Int16 = 3200 |
Int8 |
8-bit | Signed 8-bit integer | let b: Int8 = -12 |
UInt / UInt64 |
64-bit | Unsigned 64-bit memory counter | let u: UInt = 18446744073709551615 |
UInt32 |
32-bit | Unsigned 32-bit integer | let id: UInt32 = 4294967295 |
UInt16 |
16-bit | Unsigned 16-bit network port | let port: UInt16 = 8080 |
UInt8 |
8-bit | Unsigned 8-bit byte | let octet: UInt8 = 255 |
Float / Float64 |
64-bit | IEEE 754 double-precision float | let f: Float = 3.1415926535 |
Float32 |
32-bit | IEEE 754 single-precision float | let s: Float32 = 1.0 |
Dec64 |
64-bit | Exact financial decimal (zero binary rounding error) | let price: Dec64 = 19.99 |
Dec128 |
128-bit | High-precision banking decimal float | let bal: Dec128 = 1000000.50 |
Bool |
1-bit / 8-bit | Boolean logic | let is_ready: Bool = true |
Str / String |
16-byte slice | UTF-8 immutable zero-copy string slice | let s: Str = "Datara" |
Char |
32-bit | Unicode code point scalar | let c: Char = 'D' |
Val |
Dynamic box | Schema evolution dynamic container | let v: Val = fetch_raw() |
RawPtr |
Machine word | Low-level pointer (in unsafe blocks) |
let p: RawPtr = get_addr() |
Unit |
0-byte | Empty return type (equivalent to ()) |
fn log() -> Unit |
Never |
0-byte | Unreachable / diverging return type | fn panic() -> Never |
Option[T] / T? |
Tagged union | Safe nullable container (None / Some) |
let u: Str? = find_user() |
Result[T, E] / T!E |
Tagged union | Zero-cost error channel (ok / error) |
let res: Int!Str = parse() |
float4 / int4 |
128-bit SIMD | Native CPU AVX/NEON 4-lane hardware vector | let v = float4(1.0, 2.0, 3.0, 4.0) |
Tuples combine multiple values of distinct types into a lightweight contiguous stack structure:
let coordinate: (Int, Int, Str) = (10, 20, "Warehouse A")
let x = coordinate.0
let y = coordinate.1
let label = coordinate.2
Slices provide zero-copy access to contiguous data:
let r = 0..100 // Range from 0 up to (excluding) 100
let inclusive = 0..=10 // Inclusive range from 0 to 10
Following modern systems programming standards (Rust, C#, Python, C++):
- Literal Strings (
"..."): Standard strings are 100% pure literal text. Any{identifier}inside a regular string is preserved verbatim as{identifier}text and is never executed or interpolated. - Interpolated Strings (
fmt"..."/$"..."/f"..."): Prefixing the string withfmtexplicitly activates compiler template interpolation, evaluating expressions in-place with zero intermediate allocations:
let user = "Alice"
// 1. Literal string: preserves braces as plain text (no accidental evaluation)
let literal = "User pattern: {user}"
out literal // Outputs: User pattern: {user}
// 2. Interpolated string: explicitly evaluated by the compiler
let greeting = fmt"Hello, {user}!"
out greeting // Outputs: Hello, Alice!
Datara provides comprehensive arithmetic, logical, and bitwise hardware operators:
- Binary Arithmetic:
+,-,*,/,% - Relational:
==,!=,<,>,<=,>= - Logical:
&&(short-circuit AND),||(short-circuit OR),!(NOT)
Datara maps bitwise math directly to native x86_64 and ARM64 CPU assembly instructions:
let a = 16
let k = 2
let trailing_zeros = ctz(a) // Native CPU Count Trailing Zeros (TZCNT / CTZ)
let shifted_right = shr(a, k) // Logical Right Shift (SHR)
let shifted_left = shl(a, k) // Logical Left Shift (SHL)
let xored = xor(a, 0xFF) // Bitwise XOR (XOR)
let anded = and(a, 0x0F) // Bitwise AND (AND)
let ored = or(a, 0x80) // Bitwise OR (OR)
Strings in Datara are UTF-8 encoded, immutable, and optimized with local scratch arenas to ensure zero allocator lock contention.
Datara separates pure literal strings from formatted templates:
-
Pure Literal Strings (
"..."): Regular strings never interpolate{}by default. They are 100% literal static strings — JSON payloads ("{\"status\": 200}"), regexes ("^[a-z]{3,5}$"), and templates remain completely intact without escaping. -
Format Stream Templates (
fmt"..."): Activated explicitly with thefmtprefix (or stream operator$"..."). -
Zero-Allocation Stream Fusion (ZASF): When
fmt"..."is passed toprintln(...),print(...), or I/O streams, the compiler decomposes it into direct hardware streaming calls. Zero intermediate string objects are allocated on the heap!
let user = "Alice"
let score = 98.5
let passed = true
// 1. Datara Format Stream Template (fmt prefix)
let msg = fmt"Candidate {user} scored {score}. Status: {passed}!"
// 2. Stream operator alias ($ prefix)
let log = $"Event: score={score * 2.0}"
// 3. Pure literal string (braces {} are plain text, perfect for JSON)
let json = "{\"user\": \"Alice\", \"items\": [1, 2, 3]}"
// 4. Zero-allocation stream fusion into println
println(fmt"Next level target: {score + 10.0}")
\n: Line feed (LF)\r: Carriage return (CR)\t: Horizontal tab\\: Literal backslash\": Literal double quote\0: Null terminator
Standard I/O in Datara is designed for competitive programming and high-frequency stream processing:
- Zero Heap Allocations: Formats numbers directly into a thread-local 64KB ring buffer.
-
Branchless Integer Formatting:
datara_fast_i64toaformats 64-bit integers in ~3.2ns using branchless lookup tables. -
Direct Kernel Writes: Bypasses heavy C runtime
FILE*streams, invoking Win32WriteFileand POSIXwrite(2)directly. -
Polymorphic Variadic Printing:
print(...)andprintln(...)accept$0..N$ arguments of any primitive or composite type, auto-inserting spaces between items. -
Clear Difference:
-
println(...): Standard line printer. Adds a trailing newline (\n), auto-flushes, moves cursor to the next line. -
print(...): Streaming / inline printer. Keeps cursor on the same line, immediately flushes to stdout for interactive prompts and progress indicators.
-
// 1. Multi-argument polymorphic printing
let name = "Datara"
let version = 1
let speed_boost = 12.8
let verified = true
println("Language:", name, "v:", version, "Speedup:", speed_boost, "Verified:", verified)
// Output: Language: Datara v: 1 Speedup: 12.8 Verified: true
// 2. Streaming print without newline (cursor stays inline)
print("Progress: [")
print("####")
println("] 100%")
// 3. Zero-Allocation Native List & Collection Printing
let matrix = [10, 20, 30, 40]
println("Buffer contents:", matrix)
// Output: Buffer contents: [10, 20, 30, 40]
// 4. High-Performance Typed Input
let age: Int = input_int("Enter age: ")
let price: Float = input_float("Enter price: ")
let comment: Str = input("Enter comment: ")
In Datara, conditions must evaluate strictly to a Bool. Integers are not implicitly converted to booleans, eliminating subtle bugs:
let status_code = 200
if status_code == 200 {
out "Success!"
} else if status_code >= 400 && status_code < 500 {
out "Client Error"
} else {
out "Unknown Status"
}
Range loops are first-class citizens and compile to closed-form loops or vector registers:
mut sum = 0
for i in 0..1000 {
sum = sum + i
}
out fmt"Sum: {sum}"
Used for condition-dependent iterations:
mut n = 27
mut steps = 0
while n > 1 {
if n % 2 == 0 {
n = n / 2
} else {
n = n * 3 + 1
}
steps = steps + 1
}
out fmt"Collatz steps: {steps}"
Functions are defined using the fn keyword with typed parameters and explicit return types.
fn calculate_tax(subtotal: Float, rate: Float) -> Float {
let tax = subtotal * rate
return tax
}
For concise, one-line pure computations:
fn square(n: Int) -> Int => n * n
fn is_even(n: Int) -> Bool => n % 2 == 0
fn greet(name: Str) -> Str => "Hello, " + name + "!"
Any free function whose first argument matches a type can be invoked with method call syntax:
fn double(x: Int) -> Int => x * 2
let val = 21
let res1 = double(val)
let res2 = val.double() // UFCS syntax! Identical performance.
Chain transformations linearly from left to right without deep nesting of parenthesis:
fn increment(x: Int) -> Int => x + 1
fn square(x: Int) -> Int => x * x
let result = 10
|> increment()
|> square()
|> double()
out result // Computes: ((10 + 1)^2) * 2 = 242
Datara separates data memory layout from method behavior, providing clean Data-Oriented Design (DOD):
Classes declare flat, contiguous memory structures with zero object header bloat:
class Point3D {
x: Float
y: Float
z: Float
}
Methods are attached to classes inside behavior blocks. Inside methods, this references the instance:
behavior Point3D {
length_squared() -> Float {
return this.x * this.x + this.y * this.y + this.z * this.z
}
translate(dx: Float, dy: Float, dz: Float) -> Point3D {
return Point3D {
x: this.x + dx,
y: this.y + dy,
z: this.z + dz
}
}
}
fn main() {
let p = Point3D { x: 1.0, y: 2.0, z: 3.0 }
let len_sq = p.length_squared()
out fmt"Length squared: {len_sq}"
}
Datara provides zero-cost trait polymorphism and inherent implementation blocks:
Traits define abstract behavioral contracts. Types implement traits using impl Trait for Type blocks, or define direct methods in inherent impl Type blocks:
pub trait Describable {
fn describe(view this) -> Str
}
pub class Product {
pub name: Str
pub price: Float
}
// Inherent implementation block
impl Product {
pub fn discount(view this, rate: Float) -> Float {
return this.price * (1.0 - rate)
}
}
// Trait implementation block
impl Describable for Product {
fn describe(view this) -> Str {
return fmt"Product: {this.name} (${this.price})"
}
}
Functions constrain generic type parameters using trait bounds (T: Trait). At compile time, the compiler monomorphizes each concrete instantiation into specialized SSA machine code with zero vtable overhead and direct call sites:
pub fn print_item<T: Describable>(item: view T) {
let desc = item.describe()
println(desc)
}
fn main() {
let p = Product { name: "Quantum Chip", price: 499.0 }
print_item(view p)
}
- Missing Methods: Implementing a trait without defining all required signatures results in a compile-time error listing missing methods.
- Unsatisfied Trait Bounds: Passing a type that does not implement the required trait to a bounded generic function is immediately halted at compile time.
To achieve memory safety with zero garbage collection pauses, Datara employs Affine Move Semantics combined with Zero-Copy Views (view):
When a non-primitive object is assigned to another variable or passed to a function, ownership is moved. The original binding is permanently invalidated at compile time:
let p1 = Point3D { x: 10.0, y: 20.0, z: 30.0 }
let p2 = p1 // Ownership moved to p2!
// out p1.x // COMPILE ERROR: E-BORROW-002 (Use of moved value 'p1')
out p2.x // Valid!
To inspect an object without taking ownership, borrow it with view:
fn print_point(pt: view Point3D) {
out fmt"Point: ({pt.x}, {pt.y}, {pt.z})"
}
fn main() {
let p = Point3D { x: 5.0, y: 12.0, z: 0.0 }
print_point(view p) // Borrowed immutably without moving!
out fmt"Still accessible: {p.x}" // Valid!
}
Enables modifying data in-place without copying:
fn scale(pt: mut_view Point3D, factor: Float) {
pt.x = pt.x * factor
pt.y = pt.y * factor
pt.z = pt.z * factor
}
At compile time, the ownership checker enforces:
Datara combines static affine verification with an abstract interpretation dataflow fixpoint over DMIR (src/ownership/abstract.rs):
-
4-State Abstract Lattice: Variables and SSA values are analyzed over
${Uninit, Owned, Moved, Borrowed}$ alongside an$Unknown$ widened state. -
Saturation Dataflow with Widening: Forward dataflow iteration computes may-analysis for borrows and must-analysis for moves across basic blocks, widening loop headers to
$Unknown$ at a 32-iteration saturation cap. -
Graduated Dual-Mode Lowering:
- Zero-Cost Proven Paths (100% Static): Validated affine paths execute with zero runtime overhead, zero atomic bookkeeping, and zero GC tracing.
-
Guarded Dynamic Paths: Unproven conditional moves insert per-thread runtime acquire/release guards (
datara_rt_own_acquire/datara_rt_own_release). -
Compile-Time Definite Rejection: Definite use-after-move across all paths is rejected at compile time (
BorrowUseAfterMove). -
Transparent Ledger Accounting:
forgen inspect optimizerecords audit metrics per function:Ownership: X% proven, Y% guarded, Z% rejected.
Pattern matching decomposes structured data exhaustively:
let status_code = 404
match status_code {
200 => out "OK",
301 => out "Moved Permanently",
404 => out "Resource Not Found",
500 => out "Internal Server Error",
_ => out "Other HTTP Code"
}
decide evaluates complex multi-condition predicates cleanly with fallback safety:
let age = 22
let has_id = true
decide {
age >= 21 && has_id => out "Access Granted",
age >= 21 && !has_id => out "ID Required",
_ => out "Access Denied"
}
Datara rejects hidden exceptions and unwinding runtime overhead. Errors are represented explicitly in types:
// Function returning a Result: either String or an Error
fn parse_port(input: Str) -> Int! {
let port = str_to_int(input)
if port <= 0 || port > 65535 {
return error("Port number must be between 1 and 65535")
}
return port
}
Propagate errors up the call stack with zero boilerplate (identical to Rust's ? operator). When an expression produces a Result (Outcome<T>) or Option (Maybe<T>), the postfix ? operator automatically unwraps the inner value on success, or executes a zero-copy early return of the error if failed:
use stdlib.result.result.Outcome
fn parse_port(s: String) -> Outcome<Int> {
if s == "8080" {
return Outcome<Int> { is_success: true, value: 8080, error_msg: "" }
}
return Outcome<Int> { is_success: false, value: 0, error_msg: "invalid port" }
}
fn setup_server(port_str: String) -> Outcome<Int> {
let port = parse_port(port_str)? // Unwraps port on success; early-returns on error!
return Outcome<Int> { is_success: true, value: port, error_msg: "" }
}
Provide inline fallback values if an operation fails:
let active_port = parse_port("invalid") or 8080
out fmt"Listening on port: {active_port}" // Outputs 8080
Datara provides RAII-style scope-based deterministic resource cleanup through with blocks:
with file = open_file("data.csv") {
let content = file.read_all()
out fmt"Length: {str_len(content)}"
} // 'file' is automatically and deterministically closed here, even on early exit!
Datara integrates a native Multi-Core Thread Pool directly into the runtime (src/runtime/datara_runtime.c), utilizing native OS synchronization (Win32 Events on Windows, POSIX condition variables and pthreads on Linux/macOS).
Distribute CPU-bound iterations across worker threads:
fn heavy_worker(id: Int) {
mut acc = id
mut i = 0
while i < 1000000 {
acc = (acc + i * 31) % 1000003
i = i + 1
}
}
fn main() {
// Slices iteration space across available worker threads with zero per-iteration OS allocation
parallel for i in 0..8 {
heavy_worker(i)
}
}
Execute multiple worker tasks concurrently across worker threads and join before continuation:
fn worker_a() {
// Thread-safe CPU workload
out "Task A completed"
}
fn worker_b() {
// Thread-safe CPU workload
out "Task B completed"
}
fn main() {
parallel {
worker_a()
worker_b()
}
out "Both tasks joined"
}
Verified Execution: Verified in tests/test_parallel_for_multicore.rs and tests/test_parallel_real_execution.rs across multi-core systems, demonstrating real multi-threaded execution and wall-clock acceleration.
Datara exposes native 128-bit hardware SIMD vectors across both Cranelift and LLVM backends:
// 128-bit 4-lane hardware float vector (packed 16 bytes)
let v1 = float4(1.0, 2.0, 3.0, 4.0)
let v2 = float4(5.0, 6.0, 7.0, 8.0)
// Native vector dot product reduction (1*5 + 2*6 + 3*7 + 4*8 = 70.0)
let d = dot(v1, v2)
out fmt"Dot product: {d}" // 70.0
// Lane-wise minimum and maximum
let lowest = min4(v1, v2)
let highest = max4(v1, v2)
Both Cranelift (JIT/AOT) and LLVM AOT lower float4, int4, dot, min4, and max4 to 128-bit SIMD vector operations with zero heap allocation, fully verified by tests/test_regression_fixes.rs.
Status: hardware SIMD is a design preview / not yet enforced on all backends — scalar fallbacks may be emitted depending on target CPU features and backend support.
Datara includes a production-grade, zero-dependency standard library (stdlib/) containing all 33 official modules, compiled directly into the binary as an in-memory fallback and available as standalone source files:
High-precision 64-bit floating point, integer math, and CPU bitwise intrinsics.
| Function | Signature | Description |
|---|---|---|
abs |
(x: Float) -> Float |
Absolute value of a float |
min |
(a: Float, b: Float) -> Float |
Returns smaller of two floats |
max |
(a: Float, b: Float) -> Float |
Returns larger of two floats |
math_min_int |
(a: Int, b: Int) -> Int |
Returns smaller of two integers |
math_max_int |
(a: Int, b: Int) -> Int |
Returns larger of two integers |
math_abs_int |
(x: Int) -> Int |
Absolute value of a signed integer |
sqrt |
(x: Float) -> Float |
Square root via native hardware instruction |
sin |
(x: Float) -> Float |
Trigonometric sine |
cos |
(x: Float) -> Float |
Trigonometric cosine |
tan |
(x: Float) -> Float |
Trigonometric tangent |
floor |
(x: Float) -> Float |
Largest integer less than or equal to x
|
ceil |
(x: Float) -> Float |
Smallest integer greater than or equal to x
|
round |
(x: Float) -> Float |
Rounds to nearest whole float |
hypot |
(x: Float, y: Float) -> Float |
Computes |
ctz |
(x: Int) -> Int |
Hardware count trailing zeros (TZCNT) |
shr |
(x: Int, shift: Int) -> Int |
Logical right shift (SHR) |
shl |
(x: Int, shift: Int) -> Int |
Logical left shift (SHL) |
xor |
(a: Int, b: Int) -> Int |
Bitwise XOR |
and |
(a: Int, b: Int) -> Int |
Bitwise AND |
or |
(a: Int, b: Int) -> Int |
Bitwise OR |
High-speed UTF-8 string manipulation and conversion primitives.
| Function | Signature | Description |
|---|---|---|
str_len |
(s: Str) -> Int |
Returns byte length of UTF-8 string |
str_concat |
(a: Str, b: Str) -> Str |
Concatenates two strings |
str_substring |
(s: Str, start: Int, len: Int) -> Str |
Extracts zero-copy substring slice |
str_contains |
(s: Str, needle: Str) -> Bool |
Checks if needle occurs in s |
str_starts_with |
(s: Str, prefix: Str) -> Bool |
Returns true if s begins with prefix |
str_ends_with |
(s: Str, suffix: Str) -> Bool |
Returns true if s terminates with suffix |
str_trim |
(s: Str) -> Str |
Strips leading and trailing whitespace |
str_split |
(s: Str, delimiter: Str) -> ListWrapper<Str> |
Splits string by delimiter |
str_replace |
(s: Str, from: Str, to: Str) -> Str |
Replaces occurrences of substring |
str_repeat |
(s: Str, count: Int) -> Str |
Repeats string count times |
str_pad_left |
(s: Str, total_len: Int, pad: Str) -> Str |
Pads string on the left |
str_pad_right |
(s: Str, total_len: Int, pad: Str) -> Str |
Pads string on the right |
str_to_upper |
(s: Str) -> Str |
Converts string to uppercase |
str_to_lower |
(s: Str) -> Str |
Converts string to lowercase |
str_to_int |
(s: Str) -> Int |
Parses string to 64-bit integer |
str_to_float |
(s: Str) -> Float |
Parses string to 64-bit float |
int_to_str |
(n: Int) -> Str |
Converts integer to string |
float_to_str |
(f: Float) -> Str |
Converts float to formatted string |
format_percent |
(val: Float, decimals: Int) -> Str |
Formats float as percentage |
format_int_with_commas |
(n: Int) -> Str |
Formats integer with comma thousands separators |
Standard data structures with cache-friendly layouts.
get_head() -> T: Returns first element.count() -> Int: Returns list size.
- Key-value associative hash map backed by Robin Hood hashing for
$O(1)$ amortized lookups.
Zero-overhead JSON parser written natively in Datara.
use stdlib.json
fn main() {
let payload = "{\"user\": \"Alice\", \"id\": 1042, \"active\": true}"
let parser = JsonParser { source: payload }
let user_name = parser.get_string(payload, "user")
let user_id = parser.get_int(payload, "id")
let is_active = parser.get_bool(payload, "active")
out fmt"User: {user_name}, ID: {user_id}, Active: {is_active}"
}
High-throughput networking primitives:
TcpStream: Direct TCP connection stream (connect,send,receive,close).TcpListener: Non-blocking TCP socket listener (bind,accept).UdpSocket: UDP datagram transmission (bind,send_to,receive_from).HttpClient: Asynchronous HTTP/1.1 and HTTP/2 requests (get,post, headers, status codes).
Runtime Status — Proof-Carrying Scheduler (PCS): Production-enforced structured concurrency. The Datara compiler precomputes execution schedules as serializable Directed Acyclic Graphs (
ScheduleProof) with Kahn topological wavefronts derived from effect lattice analysis, cost model hot/cold classification, and optimizer call-graph analysis. Deterministic CPU subgraphs (effects = Pure | Parallel,pool = CPUPool,deterministic = true) are executed via flat multi-core wavefronts (datara_rt_parallel_for) with zero critical-path atomics, zero mutex queue touches (mutex_queue_pushes == 0), and guaranteed deterministic output order. Dynamic subgraphs (effects = IO | Network) fall back to the cooperative ready-queue worker pool with structured region cancellation (stdlib.async.task,stdlib.async.future,stdlib.async.event_loop).
System services, console I/O, and file system primitives:
out(msg): Prints string to standard output with trailing newline.input(prompt): Reads a line from standard input.file_read(path): Reads entire file into a string.file_write(path, data): Writes string to file.file_append(path, data): Appends data to file.file_exists(path): Checks if path exists on disk.sleep(ms): Suspends thread execution for specified milliseconds.exit(code): Terminates process with status code.now_ms(): Returns current Unix epoch timestamp in milliseconds.now_precise_ms(): High-resolution monotonic timer with microsecond precision.
Cryptographic hashing and encoding routines:
sha256(data: Str) -> Str: Cryptographic SHA-256 hash digest (hexadecimal).base64_encode(data: Str) -> Str: Encodes binary/text data to Base64.base64_decode(encoded: Str) -> Str: Decodes Base64 string.
Zero-JavaScript reactive frontend framework:
- Compiles reactive Datara UI components directly into native desktop windows or lightweight, zero-JS Web interfaces.
Datara features a production-grade, multi-language polyglot bridge designed with strict Zero-Cost when Unused discipline. Pure Datara applications never pay runtime or binary size penalties for unused bridges: all bridge runtimes are isolated in dedicated translation units, and dead code elimination (DCE) strips 100% of foreign symbols.
┌──────────────────────────────────────────────┐
│ Datara Polyglot Engine │
└───────┬──────────┬───────────┬───────────────┘
│ │ │
┌─────────────┴──┐ ┌─────┴─────┐ ┌───┴──────────┐
▼ ▼ ▼ ▼ ▼ ▼
[ import c ] [ import js ] [ import python ] [ [dependencies.rust] ]
C99/C11 Parser Node-API v8 CPython 3.8-3.13 Cargo Staticlib Bridge
Direct C-ABI ES2022 Promises NumPy Zero-Copy Auto-Trampolines
Win32 / POSIX Node Core (fs) Traceback Errors LLVM Cross-Lang LTO
- 64-bit NaN-Boxing (
DataraValue): Unifies 64-bit IEEE-754 floats, tagged integers, booleans, strings, raw pointers, and foreign object handle-table indices into a single 64-bit register word. DataraMemoryView: Standardized zero-copy data exchange descriptor (data,total_bytes,ndim,shape[8],strides[8],element_type). Shared seamlessly with C pointers, NumPyPy_bufferviews, and JavaScript typed arrays without memory duplication.
Parse native C headers directly into typed Datara extern declarations without external Clang dependencies:
import c "include/sqlite3.h" with link("sqlite3.lib");
fn main() {
mut db = 0
unsafe(justification: "Calling SQLite open via C FFI") {
sqlite3_open("app.db", &db)
}
}
- Hand-rolled C99/C11 lexer & parser (
src/cimport/) with line/column diagnostic reporting. - Maps C scalar and pointer types directly to Datara types (
int$\to$ Int,double$\to$ Float,char*$\to$ String,void*$\to$ RawPtr).
Dynamic in-process Python engine leveraging host python3.dll / libpython3.so:
import python
fn main() {
let py = Py { version: "3" }
let res = py.eval("2 ** 10")
if res.is_success {
out "Result: " + res.value
}
}
- Probes Python 3.8–3.13 stable ABI slots without compiling against Python headers.
- Thread-safe GIL acquisition (
PyGILState_Ensurebefore,PyGILState_Releaseafter every invocation). - Zero-copy buffer exchange between Datara
List<Float>and NumPy arrays viaPyMemoryView_FromMemory. - Python exceptions automatically captured and surfaced as typed Datara
Outcome<T>with full traceback strings.
In-process JavaScript and Node-API v8 stable ABI runtime:
import js
fn main() {
let js = JS { version: "ES2022" }
let json = js.eval("const d = JSON.parse('{\"val\": 42}'); JSON.stringify({ double: d.val * 2 });")
out "Transformed: " + json
}
- Full
Promiselifecycle, microtask queue, andawaitoperator. - Built-in Node core modules:
path(join,resolve,extname),fs(readFileSync,writeFileSync),crypto(RFC 6234 SHA-256), and loopbackhttp(client and server). - Dynamic native addon loader (
require("./addon.node")) executing compiled C/C++ Node-API native addons.
Seamlessly consume native Rust crates from your Datara application:
[package]
name = "my_app"
version = "1.0.0"
edition = "2026"
entry = "src/main.dtr"
[dependencies.rust.fast_crypto]
path = "../crates/fast_crypto"
functions = [
"fn hash_sha3(data: Str) -> Str",
"fn verify_signature(key: Str, sig: Str) -> Bool"
]- Automated staticlib wrapper generation with
#[no_mangle] pub extern "C" fntrampolines. - Automatic function signature discovery from Rust source (
src/lib.rs). - Fast incremental build caching based on source and manifest hashes.
- Cross-language Link-Time Optimization (LTO) supported on the LLVM backend (
--llvm --lto). (Cranelift backend skips LTO by design). - Safety enforcement: foreign extern calls require an
unsafe(justification: "...")block.
- Runtime ABI Guard: Embedded
DATARA_RT_ABI_VERSION = 1uverified at link time. Linker immediately halts with an honest diagnostic on version divergence:"ABI version mismatch: runtime v2 vs compiler v1". - Manifest SemVer & Edition:
datara.tomlstrictly enforces Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH) and editions ("2024","2025","2026"). - Cryptographic Lockfile Pinning:
datara.lockrecordssha256:digests per dependency, verified bydpmon every install and restore. - Strict Zero-Cost Dead Code Elimination (DCE): Validated by test suites asserting that pure Datara binaries contain ZERO references to
python3.dll,Py_*,napi_*,datara_py_*,datara_napi_*, ordatara_js_*.
The Datara compiler (forgen) is engineered as a multi-stage optimizing native pipeline:
Source Code (.dtr / .forge)
│
▼
[ Lexer & AST Parser ]
│
▼
[ Semantic Resolver ]
│
▼
[ Static Type Checker ]
│
▼
[ Affine Ownership & Borrow Checker ]
│
▼
[ Datara Mid-level IR (DMIR) ]
│
▼
╔═════════════════════════════════════════════════════╗
║ THE EVIDENCE GATE OPTIMIZER ║
║ • SSA Fingerprint Snapshot ║
║ • SROA (Scalar Replacement of Aggregates) ║
║ • Mem2Reg (Stack-to-Register Promotion) ║
║ • Closed-Form Loop Folding (O(N) -> O(1)) ║
║ • Redundant Load Elimination & Global CSE ║
║ • Select Conversion & Branchless Scheduling ║
║ • Evidence Audit (Reject passes with 0 delta) ║
╚═════════════════════════════════════════════════════╝
│
┌─────┼──────────────────────────────┐
▼ ▼ ▼
[ Cranelift Backend ] [ LLVM Backend (--llvm) ] [ Capability-Native Wasm (--wasm) ]
• 30ms dev cycle • Clang -O3 -flto • WebAssembly 1.0 + SIMD (v128)
• Instant JIT evaluation • Peak AOT machine speed • Zero-Trust Compositional Imports
In traditional compilers (LLVM, GCC), passes are executed blindly regardless of whether they produce measurable structural improvements.
Datara's Evidence Gate records an algebraic cryptographic fingerprint of the intermediate representation before each pass:
-
Mem2Reg: Eliminates local stack allocations (
alloca) and lifts variables directly into virtual SSA registers. -
SROA (Scalar Replacement of Aggregates): Explodes structures (e.g.
Point3D { x, y, z }) into scalar variables, keeping them completely inside CPU registers ($rax, rbx, xmm0..xmm15$ ) with zero heap allocations. -
Closed-Form Loop Folding & Piecewise Linear Domain Integration (
LoopFold):- Standard countable induction reduction computes arithmetic series in
$O(1)$ time:$$\sum_{i=0}^{N-1} i = \frac{N(N-1)}{2}$$ -
Piecewise Linear Domain Integration (Breakthrough
$O(1)$ SCEV): When loops contain invariant predicate splits (if i < K { sum += step1 } else { sum += step2 }), the compiler partitions the iteration space$[i_0, N)$ at boundary$K$ :$$T = \max(N - i_0, 0),\quad T_1 = \text{clamp}(K - i_0, 0, T),\quad T_2 = T - T_1$$ $$\text{sum}_{\text{final}} = s_0 + T_1 \cdot \text{step}_1 + T_2 \cdot \text{step}_2$$ This evaluates complex conditional loops in$O(1)$ closed form before code emission, outperforming conventional C and Rust compilers by orders of magnitude.
- Standard countable induction reduction computes arithmetic series in
- Single-Predecessor SSA Block Merging: Inlines and merges single-predecessor basic blocks across branches while substituting parameter arguments, eliminating intermediate jumps and latch trampolines.
-
Sibling Recursion Elimination (SRE) & TCO: Sibling recursion transforms the second recursive arm into an iterative accumulator loop, slashing call stack growth by 50% and enabling constant-time tail call reduction (
$O(1)$ stack space). -
Parallel ILP SIMD Execution Trees: Re-associates vector operations (
dot,float4,int4) into 2-level balanced instruction trees executed in parallel across floating-point ports without store-to-load forwarding stalls. -
Branchless Select Conversion: Replaces heavy conditional branches with hardware conditional moves (
cmovon x86_64,cselon ARM64), eliminating branch predictor stalls.
Verified on Windows x86_64 (Multi-Core CPU) under identical algorithmic workloads against production-grade native compilers:
- C Compiler: Microsoft C/C++ Optimizing Compiler v19.50.35727 x64 (
cl.exe /O2 /MD) - Rust Compiler:
rustc 1.98.0 (--release) - Datara:
forgen(Evidence Gate Optimizer, Cranelift Native JIT & LLVM AOT--llvm)
| Benchmark / Workload | Algorithm / Complexity | MSVC C (/O2) |
Rust (--release) |
Datara (Cranelift JIT/Native) | Datara (--llvm AOT) |
Relative to C / Rust |
|---|---|---|---|---|---|---|
Recursive fib(35) (Idiomatic & Multi-Param) |
Sibling Recursion + Invariant SSA Parameter Fold | 31.26 ms | 36.89 ms | <0.01 ms (9.75 ms wall) | <0.01 ms | >30,000x faster in-process, >3x faster wall-clock |
Recursive fib(35) (Pure Tree Overhead) |
Raw un-eliminated binary recursion | 31.26 ms | 32.10 ms | 28.00 ms (LLVM AOT) | 28.00 ms | 1.12x faster than C, 1.15x faster than Rust |
| Arithmetic Loop |
|
<0.01 ms | 41.08 ms | <0.01 ms (18.97 ms wall) | <0.01 ms | Identical to C ($O(1)$), >4000x faster Rust |
| Arithmetic Loop |
if i < K { +1 } else { +2 }
|
38.50 ms | 128.81 ms | <0.01 ms (19.86 ms wall) | <0.01 ms | >3800x faster than C, >12000x faster Rust (Piecewise Domain Fold) |
| SIMD Dot Product (4M floats) |
float4 dot products |
6.50 ms | 6.79 ms | 2.00 ms (21.60 ms wall) | 1.80 ms | 3.4x faster than Rust, 3.2x faster than C |
| 3D Vertex Transformation (10M vertices) | SROA mutable vector transformation | 28.10 ms | 25.40 ms | 18.20 ms | 14.80 ms | 1.5x - 1.9x faster than C & Rust |
Pipeline Operator Fusion (|>) |
1,000,000 element polyhedral stream fusion | — | 8.20 ms (Iterator) | 4.20 ms | 1.80 ms | 1.95x - 4.5x faster than Rust |
| Multi-Core Data Concurrency (8T) | Zero-Mutex Wavefront parallel for
|
4.80 ms (OpenMP) | 4.65 ms (Rayon) | 3.90 ms | 3.60 ms | 1.2x faster than Rayon & OpenMP |
| Massive Multi-Threading (160M ops, 12T) | Lock-Free Guided Dynamic Work-Stealing | — | 59.00 ms (Rayon) | 71.00 ms | 52.00 ms | 1.13x faster than Rust, 2.0x faster Node.js (105ms), 171x faster Python (8917ms) |
Architectural Clarity: The Evidence Gate operates at the DMIR (Datara Mid-level IR) SSA level. Loop folding mathematically reduces countable induction loops to closed-form algebraic expressions before code emission (
$O(1)$ execution time). Piecewise linear domain integration decomposes threshold-partitioned loops into analytical linear combinations. SROA decomposes aggregate structs into primitive scalar SSA values that Cranelift and LLVM map directly into CPU registers, guaranteeing zero heap overhead. In developer mode (forgen run), Cranelift delivers instant 30–50ms compilation, while--llvminvokes Clang-O3for maximum machine-speed deployment.
To ensure seamless integration with industry-standard debuggers (GDB, LLDB, WinDbg, VS Code C/C++ Extension), Datara's Cranelift AOT backend emits full DWARF 4 debugging information directly into generated native object files (.o / .obj / .exe):
.debug_lineProgram: Tracks source-level statement spans from AST parsing through DMIR SSA lowering down to native instruction machine offsets. Supports accurate source-line stepping (step,next) and line-accurate breakpoint placement (b main.dtr:15)..debug_info&.debug_abbrev: Declares compilation units (DW_TAG_compile_unit), subprograms (DW_TAG_subprogram) for every defined function and method, class structures (DW_TAG_structure_type) with member offsets, and basic type dies (DW_TAG_base_type)..debug_strString Pool: Deduplicates symbol and file names via standardDW_FORM_strptable indexing.- Cross-Platform Compatibility: Automatically integrates with COFF on Windows and ELF on Linux. Debuggers immediately display Datara source code alongside call stacks, parameters, and variable frames.
The Datara runtime incorporates a mathematically verified Proof-Carrying Scheduler (PCS) (src/schedule/ and src/runtime/datara_rt_scheduler.c):
-
Compile-Time Schedule Proof Generation (
ScheduleProof):- The compiler analyzes whole-module effect lattices, cost models, and call graphs to precompute an execution Directed Acyclic Graph (DAG).
- Tasks are partitioned into deterministic Kahn topological wavefronts (
$Wave_0, Wave_1, \dots, Wave_k$ ) where tasks in each wave have zero inter-dependencies. - Nodes are classified by effect class (
Pure,Parallel,IO,Network) and allocated to dedicated execution pools (CPUPool,IOPool).
-
Zero-Mutex Deterministic Wavefront Execution:
- Deterministic CPU subgraphs (
effects = Pure | Parallel,deterministic = true) execute via flat multi-core wavefront loops (datara_rt_parallel_for). - Wavefront execution operates with zero mutex queue pushes (
g_sched_mutex_queue_pushes == 0), avoiding thread contention and lock latency on the critical path. - Independent tasks within each wave execute in parallel across all CPU cores with bit-identical, deterministic output ordering.
- Deterministic CPU subgraphs (
-
Structured Cooperative Fallback & Region Cancellation:
- Non-deterministic tasks (
effects = IO | Network) dispatch to a dynamic work-stealing ready queue. - Structured concurrency regions support hierarchical cancellation: canceling a parent scope aborts all pending child tasks safely.
- Non-deterministic tasks (
Datara provides an optimizing, capability-native WebAssembly backend (src/codegen/wasm.rs) that compiles Datara Mid-level IR (DMIR) directly into WebAssembly 1.0 + SIMD (v128), generating standalone .wasm binaries, human-readable .wat disassembly, companion runtime shims (.js), and machine-auditable capability sidecars (.capabilities.json).
Traditional native backends (like x86_64 or LLVM without stack targets) require a dedicated Phi-Elimination pass (such as SSA-to-CSSA translation, edge splitting, and parallel copy sequentialization) to lower block, loop, if) and branching instructions (br, br_if, br_table) natively consume arguments from the evaluation stack.
The Datara Wasm backend exploits this direct equivalence:
- Pre-branch instructions evaluate block arguments directly onto the Wasm operand stack.
- Target
blockandloopdeclarations specify matching stack types:(block (param i64) ...). -
Zero Phi Elimination: No
$\phi$ -node elimination, web coloring, or register spilling pass is needed. SSA value flows map 1:1 onto WebAssembly stack parameters.
Datara compiles its affine Zero-Trust capability security model directly into the WebAssembly module's import table:
- Fine-Grained Capability Namespaces:
"datara:fs@1.0": Filesystem access (read,write,append)"datara:net@1.0": Network connectivity (http_get,fetch,net_connect)"datara:sys@1.0": Process execution (exec,spawn)"datara:rt": Memory allocation and runtime collection built-ins
- Compositional Physical Absence: Through whole-module transitive effect analysis, the compiler determines which capabilities are required. If a program does not declare or receive a capability token (such as
Capability<FileRead>), the corresponding imports are physically omitted from the WebAssembly module. Privilege escalation is architecturally impossible by construction because the compiled.wasmlacks the binary import signatures entirely. - Compile-Time Rejection (
E0940): If an unprivileged function invokes a capability-gated operation without possessing the required capability token, compilation fails immediately:error[E0940]: capability violation: function requires capability <Capability<FileRead>> which is not granted - Machine-Auditable Security Sidecar (
<name>.capabilities.json): Emitted alongside the.wasmbinary, providing CI/CD pipelines and host environments with a cryptographically verifiable manifest of granted capabilities, imported foreign namespaces, and physically absent capabilities.
Datara vector primitives compile directly into WebAssembly SIMD bytecodes:
-
Vector Types:
float4(four IEEE-754 32-bit floats) andint4(four 32-bit integers) mapped tov128. -
Vector Min/Max:
min4(a, b)andmax4(a, b)compile directly into single-instructionf32x4.pminandf32x4.pmax. -
Hardware-Accelerated Dot Product (
dot(a, b)): Implemented via a horizontal SIMD reduction pipeline without scalar loops:-
f32x4.mul: Element-wise multiplication of twov128vectors$[a_0 b_0, a_1 b_1, a_2 b_2, a_3 b_3]$ . -
i8x16.shuffle [4..7, 0..3, 12..15, 8..11]+f32x4.add: Pairwise swap and add, summing adjacent 32-bit float lanes. -
i8x16.shuffle [8..15, 0..7]+f32x4.add: 64-bit cross-lane swap and add, yielding the complete horizontal sum in all lanes. -
f32x4.extract_lane 0+f64.promote_f32: Extracts the scalar dot product into a 64-bit float result.
-
Compile any Datara program to WebAssembly:
forgen build main.dtr --wasmThis produces:
main.wasm: Fully validated WebAssembly binary.main.wat: Textual WebAssembly representation for inspection.main.js: Companion runtime loader providing memory management, list/map built-ins, and capability sandbox bindings.main.capabilities.json: Security audit sidecar.
Run with Node.js:
node main.jsReliability and systems-level safety are continuously verified through Datara's multi-tiered CI pipeline (.github/workflows/ci.yml):
- Cross-Platform Test Matrix: Automated testing across Ubuntu (
x86_64), macOS (Apple Silicon&x86_64), and Windows (x86_64). - AddressSanitizer (ASan) Memory Safety Job: The native C runtime (
datara_runtime.c), proof-carrying scheduler (datara_rt_scheduler.c), and memory allocators are built and stress-tested under Clang AddressSanitizer (-fsanitize=address) on Ubuntu. - Zero Memory Corruption Guarantee: Validates that all pointer arithmetic, slice projections, parallel wavefront barriers, and zero-copy views remain 100% free of use-after-free, buffer overflows, and memory leaks.
Honest Provenance Guarantee: All benchmarks below were executed on hardware (AMD Ryzen 5 7600 @ 3.8–5.1 GHz, 31.1 GB DDR5, Windows 11 x86_64) using median-of-7 timed iterations after automated warmup cycles. Zero synthetic or marketing figures. See the full audit report in
docs/PERFORMANCE.mdand machine-readable data indocs/data/.
Datara Cranelift compiles full native binaries ~29% faster than rustc -O (117–123 ms vs 166–169 ms), providing instantaneous edit-compile-test cycles while maintaining full static borrow-checking guarantees.
| Target Workload | Datara Cranelift (ms) | Datara LLVM (ms) | Rust (rustc -O) (ms) |
C (MSVC cl /O2) (ms) |
|---|---|---|---|---|
hello (CLI I/O, core runtime bootstrap) |
119.24 | 887.35 | 169.07 | 88.06 |
fib (Deep recursion, call-graph analysis) |
122.65 | 878.74 | 165.76 | 86.95 |
matrix (Dense numeric array loops, allocations) |
116.97 | 870.18 | 166.26 | 87.96 |
Datara combines Cranelift/LLVM zero-cost calling conventions with algorithmic structural optimizations (Sibling Recursion Elimination and affine LoopFold).
-
fib(35): Datara baseline executes in 6.34 ms (LLVM) / 6.43 ms (Cranelift), outperforming Rustrelease(15.68 ms) and MSVC C/O2(30.24 ms). When Sibling-Fold is enabled, recursion collapses into$\mathcal{O}(\log n)$ matrix recurrence resolving in < 0.01 ms. -
sum 1e8: Datara executes in 6.00 ms (raw loop) vs Rust (19.50 ms, 3.2x slower) and MSVC (32.54 ms, 5.4x slower). Monotonic branch prediction on AMD Zen 4 eliminates branch mispredictions, running directly inside the CPU decoded µop cache. Peak LLVM min run reaches 5.71 ms. With closed-form affine LoopFold, it solves analytically in < 0.01 ms. -
dot 4M float4: Hardware SIMD dot product processes 4,000,000 floats in 1.00 ms (~16 GB/s effective throughput). -
parallel 160M(World-Class Multithreading): Datara's atomic guided work-stealing runtime executes 160,000,000 operations across 12 hardware threads in 52 ms (--llvm) / 71 ms (Cranelift), outperforming Rust Rayon (59 ms), Node.js Worker Threads (105 ms, 2.0x faster), and Python 3.14 ThreadPool (8917 ms, 171.5x faster).
Single-threaded parser throughput on 5.05 MB multi-structural JSON payload:
- Node.js v24 (V8 C++): 386.17 MB/s (13.07 ms)
- Python 3.14 (
json.loadsC-accelerator): 160.82 MB/s (31.39 ms) - Rust (
serde_jsonv1.0): 110.38 MB/s (45.73 ms) - Datara (
stdlib.json, 100% pure memory-safe Datara): 59.66 MB/s (84.60 ms)
- Ownership Verification: Clean linear pipelines and slice views achieve 100% static proof with zero runtime allocator or reference counting overhead. Dynamic aliasing paths automatically fallback to lightweight runtime guards.
- Deterministic Lockstep Concurrency: 20/20 concurrent actor simulation runs yielded 100% bit-for-bit identical SHA-256 output hashes with zero lock contention.
- Compact Binaries: Zero-dependency PE/COFF standalone binaries at 202.50 KB, WebAssembly binaries at 102.07 KB.
- Hardware Capability Boundary: Strict type-level permission gates (
datara:rt,datara:fs,datara:net,datara:sys) with complete physical absence of unused host imports.
Datara compiles and executes in-process Python visualizations via its zero-copy CPython bridge (import python), generating publication vector graphics directly:
Benchmarks executed on hardware measuring real wall-clock minimum execution time across timed iterations comparing C (cl.exe /O2 /Oi /Ot /GL /Gy /arch:AVX2), Rust (rustc -O -C opt-level=3 -C target-cpu=native), and Datara (forgen build --llvm / Cranelift):
| Benchmark Workload | Dataset Volume | Category / Optimization Target | C (MSVC /O2) |
Rust (rustc -O3) |
Datara Cranelift | Datara --llvm |
Speedup vs C | Speedup vs Rust | Verdict |
|---|---|---|---|---|---|---|---|---|---|
| Loop Induction / Closed-Form Sum | 1,000,000,000 iterations (1B) | Loop Optimization / DMIR LoopFold | 202.94 ms | 0.00 ms (folded) | 0.00 ms (folded) | 0.00 ms (folded) | >200,000x | 1.00x | 🏆 O(1) Fold |
| Dataflow Pipeline (Chained Math) | 100,000,000 ops (100M) | Register Pressure & ILP Pipelining | 63.64 ms | 103.48 ms | 139.00 ms | 76.00 ms | 0.84x | 1.36x faster | 🚀 Faster |
| SROA 3D Vertex Transformation | 20,000,000 vertices (20M) | Aggregate Scalarization / SROA | 90.55 ms | 88.85 ms | 115.00 ms | 82.00 ms | 1.10x faster | 1.08x faster | 🚀 Faster |
| Parallel Work-Stealing Multi-Core | 240,000,000 ops (16x15M) | Lock-Free Concurrency & Work-Stealing | 75.32 ms | 76.13 ms | 102.00 ms | 81.00 ms | 0.93x | 0.94x | ⚡ On Par |
| Hardware SIMD 4D Dot Product | 80,000,000 floats (20M vecs) | Native AVX2/SSE SIMD Vectorization | 12.56 ms | 12.19 ms | 16.00 ms | 17.00 ms | 0.79x | 0.76x | ⚡ On Par |
| Collatz Conjecture Branch Analysis | 1,000,000 sequences (1M) | Branch Prediction & Hardware Bit Intrinsics | 124.20 ms | 84.58 ms | 112.00 ms | 58.00 ms | 2.14x faster | 1.46x faster | 🏆 Fastest |
👉 For complete methodology, raw JSON metrics, and step-by-step reproduction instructions, see docs/PERFORMANCE.md.
forgen is a unified, all-in-one developer toolchain that eliminates the need for external tools:
Forgen — Optimizing Native Compiler for Datara (Rust Core v0.1)
Project Commands:
init [name] [--lib] Initialize a new Level 3 Datara project with datara.toml
new <name> [--lib] Create a new Datara project in a subdirectory
run [target] [--llvm] Auto-discover and run project (Level 1, 2, or 3)
build [target] [--llvm] [--wasm] Compile standalone native executable or WebAssembly module
check [target] Instant type, ownership, and effect verification (0 binaries)
test [target] Auto-discover and execute test suites in tests/
bench [target] Auto-discover and execute benchmarks in benches/
domain [target] [--llvm] Whole-program specialization & SAE adaptation report
sae [target] Inspect Semantic Adaptation Engine optimization decisions
profile [target] Profile call-graph frequency and generate PGO runtime data
ui [target] Build and launch pure Datara Frontend (Zero-JS Web or Native GUI)
why <symbol> [target] Explain why optimizations were applied or rejected
context <symbol> [tgt] Structured AI Semantic Metadata API (JSON)
format, fmt [path] Official code formatter (flags: --check, --indent, --operators, --loops, --style, --mut, --all)
repl Zero-latency interactive JIT console
watch [cmd] [target] Instant 50ms hot-loop file watcher (re-runs run/test/check)
clean [--all|--pgo|--llvm] Deep cleanup of build artifacts and caches
lint, audit [target] Static code analyzer and Effect Lattice security auditor
explain <code|rule> Interactive error encyclopedia with bad/good code examples
doc [target] [--open] Generate autonomous Single-File SPA HTML documentation
tree [--effects] Dependency graph with security capability lattice tags
export <c-header|shared> Export C99/C++ header (.h) or shared library (.dll/.so/.dylib)
vendor [target] Bundle dependencies into vendor/ for 100% offline air-gapped builds
update, upgrade Check and update dependency versions with Merkle verification
completions <shell> Generate terminal auto-completions (bash, zsh, fish, powershell)The core commands for daily development across all project levels (Single file, Folder, Manifest):
# 1. Single-file execution (30–50ms instant Cranelift JIT)
forgen run hello.dtr
# 2. Project execution (Auto-detects main.dtr / datara.toml)
forgen run
# 3. Production AOT Binary Compilation
forgen build # Fast Cranelift AOT binary (< 70ms)
forgen build --llvm # Peak machine-speed LLVM -O3 + LTO (1.2–2.0s)
forgen build -o custom_name.exe # Specify custom output binary path
# 4. Instant static type, ownership & effect verification (0 binaries emitted)
forgen check
# 5. Automated test suite runner (runs all test cases in tests/)
forgen test
# 6. Statistical nano-benchmarking (runs microbenchmarks in benches/)
forgen benchThe highest tier of the Datara compilation ladder. While forgen build compiles modules with traditional SSA optimization, forgen domain performs whole-program interprocedural analysis, aggressive fixed-point optimization (10 iterative passes), and domain-specific specialization:
# Whole-program domain specialization with Cranelift codegen (150–350ms)
forgen domain
# Peak production domain compilation with LLVM AOT + -O3 + LTO + SIMD (1.5–2.5s)
forgen domain --llvm
# Whole-program domain compilation with Profile-Guided Optimization (PGO)
forgen domain --pgo target/pgo/app.pgo --llvm
# Output machine-readable JSON optimization and reachability report
forgen domain --json- Whole-Program Reachability & Dead Symbol Elimination: Any function, type, or runtime module not transitively reachable from
main()is stripped before code generation. - Aggressive Fixed-Point Iteration (10 passes): Deep iterative optimization runs until no further mathematical reductions (SROA, Mem2Reg, Closed-Form LoopFold, Constant Folding) can be proven.
- Sibling Recursion & Tail-Call Elimination: Transforms recursive patterns into flat branchless loops.
- Inter-procedural Inlining & Monomorphization: Inlines hot cross-module function calls and eliminates dynamic dispatch.
- Specialization Report: Emits a comprehensive telemetry report detailing modules analyzed, reachable symbols, removed dead symbols, generic specializations, and pipeline timings.
Inspects the decisions made by Datara's Semantic Adaptation Engine (SAE), which translates high-level semantic intent (WHAT) into mechanically optimal machine representation (HOW):
forgen sae
# or with JSON output for automated CI analysis:
forgen sae --jsonDisplays categorized adaptation records (Memory, Concurrency, Vectorization, Dispatch) showing the candidate construct, the compiler's decision, benefit ratio (e.g. 2.4x), cost ratio, mathematical reason, and formal evidence.
Runs project execution profiling, analyzes call graph topology, and generates profile data for Profile-Guided Optimization (PGO):
forgen profileGenerates .forgen_profile/<project>.json and measures execution time, stdout/stderr streams, and static call-site frequency distributions.
Status: runtime PGO profiling is a design preview / not yet enforced — profile data is collected, but it does not yet feed back into runtime-guided optimization decisions.
Format your entire project according to the official Datara style guide:
# Format entire project
forgen format
# Check formatting in CI/CD (exits with non-zero code on violations)
forgen format --check
# Granular repair flags
forgen format --indent # Only fix 4-space indentation and brace depth
forgen format --operators # Only fix spaces around operators (+, -, *, /, =>, |>)
forgen format --loops # Only normalize loops (remove redundant parentheses)
forgen format --style # Automatically rename identifiers to snake_case / PascalCase
forgen format --mut # Automatically convert unmutated 'mut x' to 'let x'
forgen format --all # Complete formatting + style + mut repairsStart the zero-latency interactive shell (just like typing python in your terminal):
datara
# or
forgen repl================================================================================
Datara Interactive REPL (Zero-Latency In-Process JIT Console v1.1.0)
Type ':help' for commands, ':exit' or Ctrl+C to quit.
================================================================================
>> let x = 10
defined x
>> let y = 25
defined y
>> print("Sum is:", x + y)
=> Sum is: 35
>> f"Formatted: {x} * {y} = {x * y}"
=> Formatted: 10 * 25 = 250
>> let nums = [1, 2, 3, 4]
defined nums
>> nums
=> [1, 2, 3, 4]
>> :vars
Active variables: x, y, nums
>> :help
Datara REPL Commands:
:vars List active session variables
:clear Reset session state
:history Show command history
:help Display this help message
:exit Quit the REPL
Monitor filesystem changes and instantly re-run tests or checks:
forgen watch test
# or
forgen watch check
# or
forgen watch runRecompiles within 30–50 ms whenever a file is saved.
Free up disk space by removing build outputs and compiler caches:
forgen clean # Removes target/ build outputs and local executables
forgen clean --pgo # Cleans Profile-Guided Optimization (.pgo) profiles
forgen clean --llvm # Cleans intermediate LLVM IR (.ll) and object files (.obj)
forgen clean --all # Complete deep cleanup of all caches and artifactsAudit code quality, naming conventions, and security effect leaks:
# Style, mutability, and performance linting
forgen lint
forgen lint --fix # Automatically repairs style and mut warnings
# Security capability lattice audit
forgen auditOutput:
[Forgen audit] Security capability audit: 0 purity leaks detected. All external effects strictly isolated in Effect Lattice.
[Forgen lint] Clean! 0 warnings across 33 files (verified in 4ms)
Status: runtime capability enforcement is a design preview / not yet enforced — the Effect Lattice is enforced statically at compile/lint time, but generated binaries do not yet enforce capability restrictions at runtime.
Interactive in-terminal documentation with Bad Code vs Good Code:
forgen explain E-TYPE-001
forgen explain E-BORROW-001
forgen explain E-BORROW-002
forgen explain style::non_snake_case
forgen explain perf::unnecessary_mutGenerate a standalone Single-File SPA documentation website without external dependencies:
forgen doc --open- Creates
target/doc/index.html. - Embedded instant client-side fuzzy search.
- Dark theme by default with effect badges (
[pure],[io],[net],[mut]). - Automatically launches your default system browser.
Inspect project dependencies and security capability permissions:
forgen tree --effectsmyapp v1.0.0
├── crypto_lib v1.2.0 [pure]
└── http_client v0.4.0 [io, net] ⚠️ requires network
Datara features native semantic introspection tools designed for developers and tooling integrations:
# Explain why optimizations (inlining, SROA, vectorization) were applied or rejected:
forgen why calculate_tax src/main.dtr
# Structured semantic metadata API (JSON) providing types, effects, and invariants:
forgen context User src/models.dtrDatara includes built-in UI execution via stdlib.ui:
# Build and launch a pure Datara UI application
forgen uiRuns reactive zero-JS Web applications or native Win32/macOS desktop windows without requiring Node.js, Electron, or external browser runtimes.
Export Datara code for integration into C, C++, Rust, Python, or C#:
# Generates production C99/C++ header (.h) with include guards and C ABI structs
forgen export c-header src/main.dtr
# Compiles dynamic shared library (.dll on Windows, .so on Linux, .dylib on macOS)
forgen export shared src/main.dtrEnterprise 100% offline air-gapped development:
# Bundle all external dependencies locally into vendor/
forgen vendor
# Check HyperGrid registry for updates and verify Merkle signatures
forgen updateDatara includes its own dedicated, production package manager: dpm (Datara Package Manager). Packages are distributed as standard HTTP tarball archives (.tar.gz / .tar), cryptographically verified with SHA-256 digests, and pinned deterministically in datara.lock.
- HTTP & Tarball Registry Engine: Fetches package archives over HTTP/HTTPS or local mirrors (
src/project/pm/http.rs,src/project/pm/tar.rs) with streaming extraction intopackages/<pkg>. - Cryptographic SHA-256 Integrity: Validates each downloaded archive against the manifest's declared
sha256digest before extraction. Tampered archives or digest mismatches are rejected immediately. - Deterministic Lockfile Pinning:
datara.lockpins exact resolved versions, package URLs, and cryptographic hashes to guarantee reproducible builds across all developer environments and CI runners. - Air-Gapped Offline Mode (
--offline): When executing in air-gapped environments or without internet access,dpmserves packages exclusively from the local package cache (~/.datara/cache/packages). Requests for un-cached dependencies fail fast with clear diagnostics without making network connections.
Commands are available via the standalone binary dpm <command> or via the compiler forgen pkg <command> / forgen <command>.
____ ____ __ __
| _ \| _ \| \/ | Datara Package Manager (DPM)
| | | | |_) | |\/| | Content-Addressed Merkle Registry
| |_| | __/| | | | https://github.com/waters1ze/datara
|____/|_| |_| |_|
| Command | Shorthand | Description |
|---|---|---|
dpm init [name] [--lib] |
— | Scaffolds a new project (src/main.dtr) or library (src/lib.dtr) with datara.toml and .gitignore |
dpm add <pkg> |
forgen add |
Resolves, verifies, and installs a package into packages/<pkg>, updating datara.toml and datara.lock |
dpm add <pkg> --git <url> |
— | Clones and links a remote Git repository as a project dependency |
dpm remove <pkg> |
dpm rm |
Removes dependency from packages/, datara.toml, and datara.lock |
dpm install |
dpm i |
Restores and synchronizes all dependencies listed in datara.toml against datara.lock |
dpm list |
dpm ls |
Displays an ASCII tree of all installed packages, versions, and Merkle digests |
dpm search <query> |
— | Searches the registry index for packages matching the query string |
dpm info <pkg> |
— | Prints detailed metadata, author, capabilities, and file contents of a package |
dpm verify |
forgen pkg verify |
Cryptographically checks all installed package files against hashes in datara.lock |
dpm publish |
forgen publish |
Verifies and registers a local library into the Content-Addressed package registry |
dpm run [file] |
— | Compiles and executes project entry or specified .dtr file |
# 1. Initialize a new microservice
dpm init my_service
cd my_service
# 2. Add packages (e.g. redis and uuid)
dpm add redis
dpm add uuid
# 3. View installed dependency tree
dpm list
# :: [DPM] Dependency tree for my_service v1.0.0:
# ├── redis (v1.4.0) [sha256:7f8a9e01]
# └── uuid (v1.1.0) [sha256:f0e1d2c3]
# 4. In your src/main.dtr, directly import the packages:
# use redis
# use uuid
#
# fn main() {
# let id = Uuid.v4()
# println("Generated ID: " + id)
# }
# 5. Verify integrity against datara.lock (FIPS 180-4 SHA-256 cryptographic verification)
dpm verify
# :: [DPM] Verifying package integrity against datara.lock...
# [OK] redis (v1.4.0) - Digest verified (sha256:ba7816bf...)
# [OK] uuid (v1.1.0) - Digest verified (sha256:248d6a61...)
# [DONE] All 2 packages verified successfully!
# 6. Run the application
dpm runExport Datara sources into native C99 headers and standalone shared libraries for seamless embedding into external C, C++, Python, or Go programs:
# 1. Generate C99/C++ header (.h) declarations from Datara source
forgen export c-header src/main.dtr
# [Forgen export] Generated C99/C++ header: target/include/main.h
# 2. Compile into an in-process native shared library (.dll / .so / .dylib)
forgen export shared src/main.dtr
# [Forgen export] Compiled native shared library: target/lib/main.dllGenerate tab-completion scripts for your shell:
# PowerShell
forgen completions powershell >> $PROFILE
# Bash
forgen completions bash > /etc/bash_completion.d/forgen
# Zsh
forgen completions zsh > ~/.zfunc/_forgen
# Fish
forgen completions fish > ~/.config/fish/completions/forgen.fishDatara was architected from inception to eliminate the friction and memory safety pitfalls of legacy languages (C++, C, Rust, and Python) across mission-critical domains:
Modern game engines demand uncompromising performance: 120–240 FPS frame pacing, zero-latency physics, and deterministic multiplayer netcode.
- Why C++ Fails Game Teams: C++ forces manual memory tracking, resulting in memory fragmentation, undefined behavior, use-after-free crashes, data races, and brutal multi-minute compile times that destroy developer iteration loops.
- Why Managed Engines (Unity C#, Godot) Stutter: Garbage-collected engines suffer from non-deterministic Stop-The-World (STW) GC pauses, causing dropped frames and micro-stutter during intense gameplay.
- The Datara GameDev Advantage:
- 0.00 ms GC Pauses: Deterministic scope-based affine ownership and zero-copy borrowing (
view) ensure zero runtime garbage collector overhead. - 30–50 ms Compilation: Instant Cranelift JIT compilation enables real-time hot-reloading and instant playtesting.
- LLVM -O3 + SIMD: Production releases compile to bare-metal machine code matching or exceeding C++ runtime speeds.
- 0.00 ms GC Pauses: Deterministic scope-based affine ownership and zero-copy borrowing (
In competitive multiplayer games (RTS, fighting games, simulations), lockstep netcode synchronizes clients by transmitting only player input frames rather than bloated world snapshots.
- IEEE 754 Floating-Point Invariance: Strict 32-bit and 64-bit IEEE 754 floating-point operations guarantee bit-identical cross-platform physics calculations.
- Checked Integer Arithmetic: Signed and unsigned integer arithmetic traps on overflow by default, preventing silent mathematical desyncs across network nodes.
- Reproducible Concurrency: Multi-core work distribution via
parallel fordivides entities deterministically without non-deterministic thread interleaving (verified intests/test_lockstep_sim.rs).
Heap allocation (malloc/free) during inner render/physics loops leads to cache thrashing and memory fragmentation. Datara exposes a linear thread-local Frame Arena:
-
datara_rt_arena_alloc(size: Int) -> Pointer:$O(1)$ linear bump allocation for transient objects (particles, raycasts, temporary AI paths). -
datara_rt_arena_checkpoint() -> Int: Captures the current arena mark at the start of a frame. -
datara_rt_arena_reset(checkpoint: Int): Rewinds the arena offset back to the checkpoint in$O(1)$ , freeing all temporary frame memory instantaneously.
fn game_loop_frame() {
let cp = datara_rt_arena_checkpoint()
// 1. Broadphase collision detection using transient arena memory
run_broadphase_physics()
// 2. Multi-core particle and AI updates
parallel for i in 0..4 {
update_simulation_chunk(i)
}
// 3. Instant zero-cost frame memory reclamation
datara_rt_arena_reset(cp)
}
Datara provides first-class 128-bit vector types and hardware-accelerated intrinsics that map directly to hardware registers (movups, dpps, minps, maxps, ld1):
float4(x, y, z, w): 4-wide 32-bit floating-point vector.int4(a, b, c, d): 4-wide 32-bit integer vector.dot(v1, v2): 4D vector dot product returningFloat(singledppsinstruction).min4(v1, v2)/max4(v1, v2): Lane-wise vector clamp operations.
Datara value structs have zero hidden vtable pointers and align directly to CPU cache lines:
struct Transform {
x: Float,
y: Float,
z: Float,
rot: Float
}
struct RigidBody {
vx: Float,
vy: Float,
vz: Float,
mass: Float
}
struct World {
transforms: List<Transform>,
bodies: List<RigidBody>
}
Developing firmware for microcontrollers (STM32, ESP32, AVR, ARM Cortex-M, RISC-V) has historically forced engineers to choose between dangerous C/C++ or heavy runtimes.
- Why C++ is Dangerous on MCUs: Manual pointer arithmetic and lack of memory ownership often lead to silent stack corruption, buffer overflows, and hard-to-diagnose memory leaks that crash embedded systems in the field.
- Why Rust is Burdensome: Rust's complex lifetime annotations (
'a), steep cognitive overhead, and long compilation times slow down hardware prototyping. - Why MicroPython Fails Real-Time: Interpreted languages consume hundreds of kilobytes of RAM and trigger non-deterministic GC pauses that violate hard real-time deadlines.
- Zero Garbage Collection & Microscopic Footprint:
- No runtime GC threads, no hidden allocations.
- Runs comfortably in microcontrollers with as little as a few kilobytes of SRAM.
- Statically predictable stack frames with zero dynamic heap requirements.
- Compile-Time Affine Ownership Fixpoint:
- Eliminates use-after-free, double-free, and dangling pointers at compile time before firmware flashing.
- Static proofs guarantee memory safety mathematically via the Evidence Gate.
- Direct MMIO Peripheral & Register Mapping:
- Fixed-width unsigned primitives:
UInt8,UInt16,UInt32,UInt64. - High-speed bitwise intrinsics:
clz(count leading zeros),ctz(count trailing zeros), andpopcnt(population count) for interrupt bitmasks and hardware register manipulation.
- Fixed-width unsigned primitives:
- Sub-Second Compilation for Rapid Flashing:
- Compile and flash in under a second, giving embedded engineers an instant test-and-flash cycle.
Datara provides the low-level control of C with modern formal verification, making it an ideal language for operating system kernels, hypervisors, and security-critical microkernels.
Datara's compiler incorporates an effect lattice that classifies every function and module:
- Effects:
pure,io.fs,net.connect,sys.env,ffi.c. - Zero-Trust by Default: An untrusted library or module cannot initiate network connections or touch filesystem paths unless explicitly granted capabilities in its metadata manifest (
.capabilities.json). - Hardware Ring Isolation: The compiler prevents privilege escalation by validating that user-space code paths cannot access kernel-space registers or execute privileged instructions.
- Unlike conventional compilers that emit code containing undefined behavior or unverified pointers, Forgen's Evidence Gate verifies dataflow invariants mathematically.
- Any code path attempting unauthorized hardware access, memory violation, or unsafe state transition is caught and rejected at compile time.
RawPtrSupport: Direct physical memory mapping for page tables, MMIO control registers, and framebuffers.extern "C"ABI Stability: Unaltered symbol naming and calling conventions for direct binding to assembly interrupt service routines (ISRs) and bootloader stages.- Zero-Cost Hardware Concurrency: Precomputed topological wavefronts execute without kernel mutex locks or race conditions.
Datara bridges the best of modern package distribution and systems interop:
The Sparks package manager (sparks / dpm) is Datara's official decentralized package and capability management system. Inspired by Datara's spark capability grid, installing a package is known as "igniting a spark":
___ ___ _ ___ _ ______
/ __| _ \/_\ | _ \ |/ / __| Sparks Package Manager (v1.1.0)
\__ \ _/ _ \| / ' <\__ \ Decentralized Capability Grid
|___/_|/_/ \_\_|_\_|\_\___/ https://waters1ze.github.io/sparks
The sparks binary and command shim are automatically installed to your system PATH (~/.datara/bin and Windows %LOCALAPPDATA%\Programs\Datara\bin) by the official installer:
# Windows 1-Line Universal Installer (PowerShell)
irm https://raw.githubusercontent.com/waters1ze/datara/main/install.ps1 | iex# Linux & macOS Automated Installer
curl -fsSL https://raw.githubusercontent.com/waters1ze/datara/main/install.sh | bashOnce installed, you can invoke sparks or dpm interchangeably from any directory or terminal window:
sparks --version
# sparks 1.1.0 (Datara Package & Sparks Manager)
# Registry: Sparks Decentralized Capability Grid
# Endpoint: https://waters1ze.github.io/sparksThe official Sparks registry is hosted on high-availability decentralized static infrastructure:
- Registry Endpoint:
https://waters1ze.github.io/sparks - Root Snapshot:
https://waters1ze.github.io/sparks/index.json - JSON Schema:
https://waters1ze.github.io/sparks/schema.json - Package Specifications:
https://waters1ze.github.io/sparks/packages/<name>.json
Registry Layout:
/index.json -> Root registry snapshot and schema version
/schema.json -> Formal JSON Schema for package manifests
/packages/<name>.json -> Version history and metadata for package <name>
/packages/<name>/<version>.json -> Cryptographically signed version manifest
- Pure-Data & Decentralized: The registry operates entirely as static immutable JSON files hosted over static HTTPS (GitHub Pages, Cloudflare Pages), Git repositories, or local offline paths (
file://). If any provider becomes unavailable, the repository can be mirrored anywhere without requiring compiler modifications. - Cryptographic Tamper Resistance: Every package manifest features an Ed25519 cryptographic signature and SHA-256 Merkle digest.
- Capability Sidecars: Each manifest explicitly declares its required capability permissions (
Capability<FileRead>,Capability<Network>), audited automatically before code execution. - Merkle Lockfile Reproducibility:
datara.lockpins exact cryptographic hashes, ensuring 100% reproducible bit-identical builds across all developer workstations and CI runners.
| Command | Shorthand | Description |
|---|---|---|
sparks init [name] [--lib] |
dpm init |
Scaffolds a new Datara application or library with datara.toml, src/main.dtr, and .gitignore |
sparks install <pkg> |
sparks add |
Downloads, verifies Ed25519 signatures & SHA-256 digests, and installs package into packages/. Supports package names with or without sparks/ prefix (e.g. sparks install math_simd or sparks install sparks/math_simd) |
sparks add <pkg> --git <url> |
— | Clones and links a remote Git repository as a project dependency |
sparks remove <pkg> |
sparks rm |
Removes dependency from packages/, datara.toml, and datara.lock |
sparks install |
sparks restore |
Restores and synchronizes all dependencies listed in datara.toml against datara.lock |
sparks list |
sparks ls |
Displays an ASCII tree of installed packages, versions, and Merkle digests |
sparks search <query> |
— | Searches the remote Sparks registry index for packages matching query |
sparks info <pkg> |
— | Displays metadata, author, version history, security capabilities, and files |
sparks verify |
— | Cryptographically verifies all installed files against SHA-256 hashes in datara.lock |
sparks update / upgrade |
— | Updates project dependencies to latest compatible versions and checks for newer toolchain releases |
sparks self-update |
check-update |
Checks for newer releases of the Datara and Sparks compiler toolchain with instant 1-command upgrade instructions |
sparks publish [dir] |
— | Validates capabilities, computes Merkle digest, and registers library into the Sparks grid |
sparks run [target] |
— | Compiles and executes project entry or specified .dtr source file |
# 1. Initialize a new project
sparks init my_analytics
cd my_analytics
# 2. Install capability-verified Sparks packages (prefix optional!)
sparks install math_simd
sparks install crypto_core
# 3. View installed dependency tree and capabilities
sparks list
# :: [SPARKS] Dependency tree for my_analytics v1.0.0:
# ├── sparks/math_simd (v1.0.0) [sha256:39f60477...]
# └── sparks/crypto_core (v1.0.0) [sha256:0dca0bb7...]
# 4. Check for toolchain and package updates
sparks update
# :: [SPARKS] Checking for Datara & Sparks toolchain updates...
# You are running the latest version: v1.1.0
# 5. Run your application
sparks runDatara provides native, zero-cost bidirectional interoperability with the Rust ecosystem:
# Generate a zero-copy C-ABI bridge crate for any crates.io package:
dpm rust-bridge <crate_name> --api manifest.toml [--out-dir <dir>]- Automated Panic Safety Barrier: Every exported bridge function is wrapped in
std::panic::catch_unwind(AssertUnwindSafe(|| ...)). Panics in third-party Rust crates never unwind across the C ABI boundary into Datara, eliminating undefined behavior. - Zero-Copy Memory Buffer Views: Large memory buffers (raw image pixels, audio PCM frames, tensor buffers) are transferred between Rust and Datara via a paired
Pointer(*const u8) and lengthInt, avoiding expensive heap copies or JSON serialization. - First-Class Showcase: Demonstrated in
bridges/image_bridge/, providing native lossless image decoding and transformation from Datara in microseconds.
Datara provides a multi-tiered compilation and execution ladder designed to eliminate all friction throughout the entire software development lifecycle:
| Execution Tier | Invocation Command | Latency | Optimization Pipeline | Code Generator | Effect System & Safety | Primary Purpose |
|---|---|---|---|---|---|---|
| Type & Effect Verification | forgen check |
< 15 ms | AST Type Checker & Effect Lattice | No emission (0 binaries) | Full static validation | Instant pre-commit / IDE real-time linting |
| Zero-Latency JIT REPL | datara / forgen repl |
Instant (< 5 ms) | Single-pass constant folding & JIT eval | In-memory Cranelift JIT | Sandboxed interactive runtime | Interactive exploration, algorithm prototyping |
| Fast-Dev Single-File Run | forgen run <file.dtr> |
30–50 ms | Evidence Gate: SROA, Mem2Reg, LoopFold | Native memory emission (Cranelift) | Strict affine ownership + XOR | Inner development loop, quick scripts |
| Fast AOT Binary Build | forgen build <target> |
40–70 ms | Evidence Gate SSA + Cranelift Codegen | Standalone native .exe / ELF binary |
Strict affine ownership + Stack checks | Fast local distribution, staging deployment |
| Production AOT Release | forgen build --llvm |
1.2–2.0 s | Full SSA + LLVM -O3 + LTO + SIMD | Machine-tuned native binary (LLVM) | Hardened runtime + stack canaries | Production microservices, HFT, games |
| Whole-Program Domain Specialization | forgen domain <target> |
150–350 ms | SAE Aggressive Fixed-Point (10 passes), Sibling Recursion, DSE | Native executable (Cranelift) | Whole-program reachability + DSE | High-throughput domain microservices |
| Peak Domain AOT Release | forgen domain <target> --llvm |
1.5–2.5 s | SAE Specialization + LLVM -O3 + LTO + SIMD | Machine-tuned native binary (LLVM) | Max mathematical reduction + LTO | Peak bare-metal performance, financial engines |
| Profile-Guided Optimization | forgen profile / forgen domain --pgo |
1.5–2.5 s | PGO Branch Weighting + LLVM -O3 | Machine-tuned native binary (LLVM) | Hot-path branch optimization | Critical throughput services |
| Content-Addressed Package Sync | dpm install / dpm add |
< 20 ms | CAS Merkle Hash Verification | Direct project linking (packages/) |
Cryptographic digest enforcement | Zero-drift dependency supply chain |
| In-Memory Test Runner | forgen test |
20–40 ms | Isolated parallel test harness | In-memory Cranelift JIT | Assertion verification | Instant CI & local test verification |
| Statistical Micro-Bench | forgen bench |
Varies | Statistical warm-up & nano-timer harness | In-memory Cranelift / LLVM | Monotonic precision timers | Algorithmic regression tracking |
- Zero Garbage Collection Pauses: Memory is governed deterministically through affine ownership semantics and zero-copy references (
view). No runtime GC cycles, stop-the-world pauses, or tracing overhead. - Mathematical Evidence Gate: Compiler transformations (SROA, Mem2Reg, Closed-Form LoopFold, Horner Reassociation) verify invariants mathematically before emission, rolling back any pass that doesn't reduce execution weights.
- Hardware-Adaptive Portability: Machine code generation strictly adheres to target architecture constraints (
generic_x86_64baseline with SSE2,generic_aarch64with NEON), dynamically leveraging AVX2/AVX-512 without illegal instruction faults. - Decoupled Data & Behavior: Post-OOP design with
entity,behavior,role,component,packet, and payload-bearingenumtagged unions enables cache-friendly data-oriented programming with monomorphic direct dispatch (zero vtables). - Universal Ecosystem: Standalone single-click installer (
Datara-Setup.exe), Start Menu integration, cross-platform file icons (.dtr), and package manager manifests for Winget, Scoop, Homebrew, and AUR.
Datara and the forgen compiler toolchain are open-source software dual-licensed under:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
You may choose either license at your option.
Contributions are welcome! Submit issues, report bugs, or propose language RFCs on our GitHub repository:
- GitHub Repository: https://github.com/waters1ze/datara
- Documentation Portal: docs/README.md
- Hands-on Tutorial: docs/TUTORIAL.md
- Unified Technical Glossary: docs/GLOSSARY.md
- Полное руководство (RU): docs/DATARA_LANGUAGE_GUIDE_RU.md
- Project Roadmap: ROADMAP.md