CLAUDE.md
Frits is a scripting language for Pinnacle (and later the Cartopolis
simulator). docs/design.md holds the decisions, what is built, the
measurements and what is missing; read it before changing the language.
Build
Builds run on a midas node (midas run -- cargo …, or midas take then
ssh <node> …). The landing gate is cargo test --locked --workspace.
cargo test --workspace # crates/frits unit tests, the ported scripts in crates/bench,
# and crates/aot-check (natives generated at build time vs the interpreter)
cargo run --release -p frits-bench # numbers comparable with Cartopolis's Luau/Bun table; run on mac-1
cargo clippy --workspace --all-targets
Rules
- No outside crates, like Pinnacle: everything is written here.
#![forbid(unsafe_code)]infrits. A VM bug may give a wrong answer or stop a script, never corrupt memory.- Every path that runs uploaded script code goes through
Process::run's loop, which counts fuel per instruction. A host function must never call back into script code: that would be a context that cannot be paused. Native code (aot.rs) is the one exception, and only for installed apps. - A new
Opneeds three places: the compiler that emits it, the VM (vm.rs) and the native code generator (aot.rs);crates/aot-checkcatches a generator that disagrees with the VM. - A process's heap is its own. Values cross between processes, or to the
host, only as
HostValue(copied). Never hand aValue::Objfrom one heap to another process. - Record fields are stored in name order. A host building a record with
Cx::recordpasses the fields sorted by name. - Ported Cartopolis scripts live in
crates/bench/scripts/, with behaviour tests incrates/bench/src/main.rs: when the language changes, they must still read naturally.