Raic (T-AST) — LLM quick reference
Raic is Rust, compressed via T-AST (Tokenized AST): postfix opcodes and type abbreviations that expand to idiomatic Rust. The executable spec is tests/integration.rs; the full story is README.md.
Mental model
- One file lists items: struct lines (
@ …) and/or function lines (name … : ret = opcodes). - No
fn { }/letin the T-AST surface for opcode-driven code—the compiler expands patterns. - Deterministic: same T-AST → same Rust for a given compiler version.
Types (abbreviations)
| T-AST | Rust |
|---|---|
I |
i32 |
N |
usize |
b |
bool |
s |
&str (in signatures) |
S |
String |
[(A B)] |
Vec<(A', B')> with inner types expanded |
M<K V> |
HashMap<K', V'> |
Structs
One line:
@ User id:N name:S
Functions
name arg_ty … : ret_ty = opcode …
Top-level : separates arguments from return type. = separates the signature from the opcode body (whitespace-separated tokens).
Supported expansion (example):
top_words s N : [(S N)] = Ws Fm Vi Sd Tk
Maps to the word-frequency / sort / take pipeline in the integration tests.
Opcodes (v1 compiler)
Documented chain: Ws, Fm, Vi, Sd, Tk (see README). More opcodes will be added over time; undefined sequences fail to compile.
Compile
raic compile main.rc -o generated.rs
Longer tutorial for models
Use llm_eval/preamble.md (~3000 tokens) for evaluation runs. For day-to-day work, README.md + integration tests are enough.