Frits
Frits is the scripting language of Pinnacle, meant to run in the Cartopolis simulator as well. It replaces TypeScript/Bun for apps, scripts, the shell and prim scripts.
Written in Rust with no outside crates, like Pinnacle itself.
- Typed, without writing many types. Records, enums and
match, and nonull. Locals are inferred. - Every script is a small process with its own heap. Its memory has a ceiling, and its time has a fuel slice per tick. A script that runs too long is paused and resumed, not killed.
- Effects are rights.
script / Prim, Chatsays what a script may touch, andfn fly() / Primwhat a function does. The compiler holds both to it.Secret<T>values can be passed on but never read;opaquehost types are rights a script cannot forge. - Everyday features: closures, generics,
Resultwith?, pattern matching, lists, maps,Vec3, messages between scripts,keep varstate that survives restarts,testblocks, and views written as markup. - Tools:
frits fmt, a language server (frits lsp), a scripting guide generated from the platform (frits guide), and ahead-of-time compilation to Rust (frits aot).
script / Prim, Chat, Timer
enum State { Patrol, Summoned }
var state = Patrol
on timer() {
match state {
Patrol => Prim.set_geo({ lat: 53.2194, lng: 6.5665 }),
Summoned => Chat.say("Coming, {Timer.now():.1} s in."),
}
}
docs/design.md describes the language, the runtime and how they measure
against Luau and Bun.
cargo test --workspace # the language's tests and the ported Cartopolis scripts
cargo run --release -p frits-bench # the benchmark against the simulator scenarios
cargo run -p frits -- run hello.frits # a script on the console platform (`on main()`)
cargo run -p frits -- test hello.frits # its `test` blocks
cargo run -p frits -- fmt hello.frits # format it
Licence
MIT OR Apache-2.0, at your option (LICENSE).