DEXA language logo

DEXA

Unified Compute Language

Documentation · Draft

DEXA Language Overview

This is an early draft of the DEXA language. The syntax and semantics below are not stable and will change as the compiler and type system solidify. Use this as a guide to the intent and shape of the language.

Status: Experimental · Compiler prototype in Rust · Contributions via GitHub.

New to the language surface? Start with the DEXA Language Tour, then come back here for details.

Getting started (prototype)

The reference compiler is being built in Rust. At this stage, DEXA is not ready for production workloads, but you can explore the syntax and contribute to the design.

  1. Clone the repository: git clone https://github.com/dxiv/dxa-dev
  2. Enter the compiler directory: cd compiler
  3. Run the prototype on an example: cargo run -- ../examples/hello.dexa

The current compiler can parse and typecheck a subset of the language: functions, blocks, let/let mut, if/else, and basic expressions.

Example · Minimal program

fn add(a: int, b: int) -> int {
    return a + b;
}

fn main() {
    let three: int = add(1, 2);
    return;
}

Core syntax

Functions

Functions are declared with fn, a name, parameters, an optional return type, and a block body.

fn sigmoid(x: float) -> float {
    return 1.0 / (1.0 + exp(-x));
}

Statements

The prototype supports let bindings, return, expression statements, and basic if/else control flow.

fn step() {
    let lr: float = 0.01;
    let loss: float = compute_loss();
    if loss > 0.0 {
        update_weights(lr, loss);
    }
}

Types

Primitive types

  • int — fixed-width integer
  • float — floating point value
  • bool — true/false
  • string — UTF-8 string
  • Address — contract address / identity (reserved)

Planned core types

  • tensor<T, shape> — n-dimensional tensors for AI/ML.
  • asset<T> — tracked assets for contracts.
  • model — model definitions bound to tensor graphs.
  • contract — verifiable, deterministic contract units.

Tensor and asset types are not fully implemented yet, but the syntax and semantics are being designed in parallel with the compiler.

Execution model (prototype)

Pipeline

  1. Source .dexa → tokens (lexer)
  2. Tokens → AST (functions, blocks, let/let mut, if/else, expressions)
  3. AST → typechecked tree (primitive types only)
  4. AST → DX-IR (locals, blocks, Let, Store, If, Return, calls, binary ops)
  5. IR → result via a simple interpreter

What this means today

  • You can write small, pure integer/float/bool programs that actually execute.
  • Type errors (wrong arg types, assigning to non-mut vars, non-bool conditions) are caught before execution.
  • The IR is intentionally small so it can be extended later for tensors, contracts, and real backends.

Think of this as DX-IR v0: enough to prove the language core and semantics before any “web3 / GPU” buzzwords show up.

Compiler & language roadmap

Now

  • Lexer & parser prototype
  • Functions, blocks, if/else
  • let/let mut and assignments
  • Primitive typechecker + interpreter

Next

  • Richer control flow (while, loop, break, continue).
  • Better diagnostics and error reporting
  • Initial tensor & asset semantics

Later

  • DX-IR & multiple backends
  • Contract subset & DX-VM
  • Playground & full docs site

Contributing

If you have opinions about type systems, determinism, GPU backends, or contract safety, you’re the target audience. The fastest way to influence DEXA is to show up while it’s still being carved out.

Discuss design and implementation via GitHub issues or message DX directly on Discord / Telegram.