Astreum

ASTREUM LANGUAGE

(1 2 +)3

A stack-based language built on Expressions

Postfix evaluation over a simple data model of links, symbols, numbers, byte strings, and strings. Includes built-in concurrency with actors.

WHAT IT IS

Small, explicit, and content-addressed

A postfix language built around a stack-based virtual machine, built-in operators, and a content-addressed expression model. Designed for transparency, auditability, and deterministic execution in smart contracts and off-chain tooling.

Smart contracts

Metered execution with a clear stack model, content-addressed expressions, and explicit module boundaries keeps contract logic transparent and verifiable.

General applications

Write scripts, services, and tooling where clarity, composability, and content-based addressing matter — without sacrificing ergonomics.

Concurrent actors

Built-in actor model with message passing: spawn lightweight threads, send and receive over named mailboxes, all within the same expression evaluator.

FEATURE SUMMARY

Current version: 0.21.4

  • Stack-based evaluation with postfix operator dispatch, a ' special form, and a quote stack operator.
  • Six built-in expression types as a single Expr class with a string _tag: link/symbol/bytes (base, direct wire encoding) and int/float/str (composed, serialize as link(bytes(payload), symbol(tag))). User-defined types are open — any symbol creates a new type at runtime.
  • Open type system with structurally embedded tags — the type is the terminal symbol of every value's canonical link form. User types are created with init and introspected with type. Type names are also constructors: (3 5 point) constructs a point.
  • Built-in operators covering arithmetic, comparison, bitwise logic, stack manipulation, expression construction, type creation and conversion, byte-string operations, control flow, quotation, code/storage, and actor message passing.
  • Content-addressed storage model with hash pointers (head_hash/tail_hash) for DAG-based expression graphs, runtime hash resolution via ref/load, and binary serialization via to_bytes/from_bytes.
  • Module system with file imports, reference imports, prefix-qualified namespaces, and circular-import protection.
  • Metered execution (Meter/MeterExceededError) with size-based costing per operation.
  • Deterministic execution mode that disables spawn, send, receive, eval, ref, and load for reproducible evaluation.
  • Scoped environments: lexical parent chains for lookup; def within closure writes to the captured environment.
  • Tagged result operators — append ? to any operator name to wrap the outcome as (ok . value) on success or (err . reason) on error, enabling structured error handling without bare NIL checks.

EXPLORE

Learn more about the language