This guide introduces a curated set of T81 data types through a runnable example (examples/data_types.t81). The goal is to show how primitives, strings, and structural types behave once compiled with the t81 CLI.
| Category | Types | Highlights |
|---|---|---|
| Primitives | i32, T81Float, T81String |
Basic arithmetic, floating-point adjustments, and string literals |
| Structural | Option[T], Result[T, E] |
Pattern-match both constructors and inspect the canonical TISC branches |
examples/data_types.t81fn demo_primitives() -> i32 { ... }
fn demo_structural() -> i32 { ... }
fn main() -> i32 { ... }
The example showcases:
demo_primitives()."primitives") assigned to T81String.Option[i32] and Result[i32, T81String] usages with exhaustive match expressions../build/t81 code build examples/data_types.t81 -o /tmp/data_types.tisc
./build/t81 code run /tmp/data_types.tisc
./build/t81 code build examples/fraction_demo.t81 -o /tmp/fraction_demo.tisc
./build/t81 code run /tmp/fraction_demo.tisc
./build/t81 code build examples/tensor_demo.t81 -o /tmp/tensor_demo.tisc
./build/t81 code run /tmp/tensor_demo.tisc
./build/t81 code build examples/bigint_demo.t81 -o /tmp/bigint_demo.tisc
./build/t81 code run /tmp/bigint_demo.tisc
./build/t81 code build examples/float_demo.t81 -o /tmp/float_demo.tisc
./build/t81 code run /tmp/float_demo.tisc
./build/t81 code build examples/string_demo.t81 -o /tmp/string_demo.tisc
./build/t81 code run /tmp/string_demo.tisc
./build/t81 code build examples/vector_demo.t81 -o /tmp/vector_demo.tisc
./build/t81 code run /tmp/vector_demo.tisc
./build/t81 code build examples/matrix_demo.t81 -o /tmp/matrix_demo.tisc
./build/t81 code run /tmp/matrix_demo.tisc
./build/t81 code build examples/cell_demo.t81 -o /tmp/cell_demo.tisc
./build/t81 code run /tmp/cell_demo.tisc
./build/t81 code build examples/quaternion_demo.t81 -o /tmp/quaternion_demo.tisc
./build/t81 code run /tmp/quaternion_demo.tisc
./build/t81 code build examples/high_rank_tensor_demo.t81 -o /tmp/high_rank_tensor_demo.tisc
./build/t81 code run /tmp/high_rank_tensor_demo.tisc
./build/t81 code build examples/graph_demo.t81 -o /tmp/graph_demo.tisc
./build/t81 code run /tmp/graph_demo.tisc
Use scripts/run-demos.sh (which now runs match, primitive, fraction, tensor, bigint, float, string, vector, matrix, cell, quaternion, high-rank tensor, and graph demos) to execute the entire suite in sequence.
examples/high_rank_tensor_demo.t81 declares a Tensor[i32, 2, 2, 2] literal, performs nested indexing to reach opposite corners of the block, and returns the balanced ternary sum so you can see deterministic reductions across three dimensions.examples/graph_demo.t81 treats an adjacency matrix as a Matrix[i32, 3, 3], reads pairs of matrix entries that represent edges, and totals them to demonstrate how graphs can be encoded as tensors in T81Lang.T81Fraction operations (normalization, comparisons) by modifying examples/fraction_demo.t81.T81Graph, T81Stream, T81Promise, etc.) using this page and the scripts as templates so the evolution stays systematic.The core handles in include/t81/types (notably T81IOStream, T81Promise<T>, and T81Agent) require future language bindings. Here is what a T81Lang demo could look like once these constructs are available:
fn stream_log() {
let log = stream::stdout();
log << "Starting deterministic log\n";
log << current_time();
}
fn await_prediction() -> T81String {
let promise: T81Promise[T81String] = dream::compute_meaning_of_life();
return promise.await(T81Entropy::acquire_batch(64));
}
fn agent_loop(agent: T81Agent) {
agent.observe(symbols::SELF_PRESERVATION);
agent.act();
let reflection = agent.reflect();
log << "Agent intent: " << reflection.intent();
}
Enable these demos by:
stream::stdout, dream::compute_meaning_of_life, and coroutine syntax for await.T81Promise/T81Agent semantics to the IR with explicit entropy/fuel operands and serialization hooks so the HanoiVM can enforce deterministic accounting.scripts/run-demos.sh) to compile/run these sources once the language and IR support the constructs.For now, treat these snippets as a roadmap: they explain the control flow and thermodynamic accounting we want to expose when the remaining handle APIs are fully implemented.
You should see the CLI report “Compilation successful” followed by “Program terminated normally,” and the HanoiVM registers will contain the computed sum.
T81Fraction, vectors) by introducing new functions and accumulating their results in main.match to deconstruct handles like Option, Result, or future sequencers such as Tensor handles once the language supports them.