DEXA language logo

DEXA

Unified Compute Language

Spec (snapshot)

What DEXA actually supports right now

This is a living snapshot of the currently implemented language surface. Future features (tensors, actors, contracts, DX-VM, GPU) are intentionally omitted here until they exist in the compiler.

Types

Types implemented in the typechecker and interpreter:

There are no implicit coercions in DEXA. In particular, there is no implicit string ↔ address. Conversions must be explicit via the address("...") builtin.

Nominal records (models & contracts)

Nominal record types are declared via model or contract. Records are nominal: two record types with identical fields are still different types.

model Wallet {
    owner: address
    balance: int
}

Record literals

let w: Wallet = Wallet { owner: address("addr:test"); balance: 0; };

Defaults & record update

Functions

Declared with fn:

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

Variables & mutability

fn main() -> int {
    let x: int = 1;        // immutable
    let mut y: int = 2;    // mutable

    // x = 3;   // ❌ compile-time error
    y = y + 1; // ✅

    return y;
}

Expressions & operators

Currently implemented expression forms:

fn main() -> bool {
    let x: int = 10;
    let y: int = 20;
    let bigger: int = max(x, y);
    return bigger > 15 && bigger < 30;
}

Control flow

Implemented constructs

fn classify(x: int) -> bool {
    if x >= 0 && x < 10 {
        return true;
    } else {
        return false;
    }
}
fn countdown(start: int) {
    let mut x: int = start;

    while x > 0 {
        x = x - 1;
        if x == 2 {
            continue;
        }
        if x == 1 {
            break;
        }
    }

    return;
}

Builtins / special forms

Implemented builtins / special forms:

require

fn main() {
    let x: int = 5;
    require(x > 0);
    require(x > 0, "x must be positive");
    return;
}

Execution model (current prototype)

The reference compiler currently targets a simple interpreted IR. Every DEXA program goes through:

  1. Parse source into an AST (functions, blocks, if/else, expressions).
  2. Typecheck with an explicit environment of locals, function signatures, and nominal record types.
  3. Lower to a small IR with locals, basic blocks, If, While, Loop, Return, calls, and records.
  4. Validate IR invariants (fail-fast firewall) before execution.
  5. Interpret the IR to produce a structured program result rather than just a raw integer.

Executing main always yields a ProgramResult:

ProgramResult::Ok {
    value: Value,
    prints: Vec<String>,
    trace: ExecutionTrace,
    gas: GasMeter,
}

ProgramResult::RequireFail {
    message: String,
    trace: ExecutionTrace,
    gas: GasMeter,
}

IR validation exists to stop the runtime from “accepting garbage.” For records, this includes invariants like: known record types, no duplicate fields, no unknown fields, and fully materialized record literals after lowering.

This page tracks the implemented core only. Anything mentioned on the homepage but not listed here (tensors, GPU, actors, contracts, DX-VM) is still in design / prototype.