- Rust 94.2%
- C 3.2%
- Latte 1%
- JavaScript 0.9%
- Promela 0.3%
- Other 0.4%
Latte
Latte is an embeddable scripting system for narrative logic in games.
Features
-
A minimalist dynamically-typed language
- Supported types: null, boolean, numbers, strings, arrays, and functions
-
Rust-inspired syntax
fn name () { ... },if <expr> { ... }, the last expression in a block becomes the return value- Labels (
'a: <stmt>) andgoto 'a - Local variables (
var foo;)
-
Global variables
static g_foo = <expr>;defines a global variable- Global variables can be (de)serialized
-
Reactive global variables ("bindings") and exports
let g_foo = <expr>;tracks dependencies and re-evaluates when input variables changeexport.main = fn () { ... };exports a function to be called by the host
-
Supports model checking via the SPIN model checker
- A model checker checks for runtime errors (assertion failures, uninitialized variable uses, etc.) though an exhaustive or approximate search over all possible runtime choices.
Example
See crates/latte_text/examples/vending_machine/main.latte for an example.
Primary Crates
Runtime
The following crates are the main entry point for embedders:
-
latte_player: A virtual machine (VM) implementation for executing Latte scripts. -
latte_spin: A virtual machine (VM) implementation for verifying Latte scripts using the SPIN model checker.
Compiler
The following crates can be used to build custom Latte compilers or tools:
-
latte_hir- High-level Intermediate Representation (HIR). Handles parsing of Latte source files and defines the AST and HIR data structures. -
latte_mir- Mid-level Intermediate Representation (MIR). Defines the MIR data structures. Includes transformation passes (dead code elimination, simplification, SSA conversion) and analysis passes.
Example Game Engine
-
latte_text: An example interactive novel game controller implemented on top oflatte_player. -
latte_text_tui: A TUI frontend forlatte_text. -
latte_text_mcp: A Model Context Protocol (MCP) frontend forlatte_text. -
latte_text_spin_cli: A model checker forlatte_text.
Note:
latte_text*crates are example code and may be removed in part or in whole at any time without prior notice.
License
This work is licensed under the European Union Public License (EUPL) 1.2.
The example game engine crates (latte_text*) are dedicated to the public domain under the 0BSD license.