[ LANGUAGE TOUR ]
Learn DEXA in ~5 minutes
What's implemented now. Parser → typechecker → DX-IR → interpreter.
DEXA — the DXA smart‑contract language (.dxa files, dxc compiler on dxa.dev).
[ 1 · VALUES & TYPES ]#
int, float, bool, string, unit, address, model records. No implicit coercions; address("...") required.
let a: int = 42;
let pi: float = 3.1415;
let ok: bool = true;
Run in Playground →
Top-level let runs as-is. Add fn main() -> int { return 0; } to return a value from the program.
[ 2 · FUNCTIONS & CALLS ]#
fn with typed params; return type optional (defaults to unit). Calls typechecked for arity and types.
[ 3 · BUILTINS ]#
abs, min, max, sqrt, len; plus print, address, require. No need to define these yourself.
fn main() -> int {
require(abs(-7) == 7 && sqrt(4.0) == 2.0, "abs/sqrt");
require(min(1, 2) == 1 && max(1, 2) == 2 && len("hi") == 2, "min/max/len");
return 0;
}
Run in Playground →
[ 4 · BRANCHING & REQUIRE ]#
if/else (bool). require(cond) / require(cond, "msg") — on false, execution aborts with RequireFail.
[ 5 · MUTABILITY & LOOPS ]#
let vs let mut; block shadowing. while, loop, break, continue — wired through parser → IR → interpreter.