Expand description
The data a frontend produces and a backend consumes.
This is the interface that keeps frontends and backends independent. A
frontend emits a ScriptPackage, whatever its input looks like. A backend
turns the functions inside it into callable crate::function::Function
values. Neither has to know the other.
§Shape of the data
ScriptPackage
ScriptModule name
ScriptStruct name, fields
ScriptEnum name, variants
ScriptFunction signature + Script
ScriptOperation the actual instructions§Operations
ScriptOperation is deliberately small: define and move registers, call a
function, branch, loop, return, suspend. That is the common set every
frontend and backend can share. Anything more specific, such as pushing a
literal, goes into ScriptOperation::Expression and the
ScriptExpression type a frontend defines for itself.
§Loading
ScriptContentProvider is the other half. It fetches source by path, so a
frontend can follow imports without knowing where they live.
Structs§
- Extension
Content Provider - Dispatches to another provider based on the file extension.
- File
Content Provider - Loads scripts from the file system.
- Ignore
Content Provider - A provider that loads nothing.
- Inline
Expression - A ready-made
ScriptExpressionbuilt from a closure. - Script
Builder - Assembles a
Scriptone operation at a time. - Script
Content - One loaded source unit, as
ScriptContentProvider::unpack_loadreturns it. - Script
Enum - An enum a frontend produced.
- Script
Enum Variant - An enum variant as a frontend describes it.
- Script
Function - A function a frontend produced: an unresolved signature and its operations.
- Script
Function Parameter - A function parameter as a frontend describes it, by type query rather than by resolved type.
- Script
Function Signature - A function signature as a frontend describes it, with types still unresolved.
- Script
Module - A named group of types and functions, as a frontend produced it.
- Script
Package - A whole compilation unit: the modules a frontend produced.
- Script
Struct - A struct a frontend produced.
- Script
Struct Field - A struct field as a frontend describes it, by type query rather than by resolved type.
Enums§
- Extension
Content Provider Error - What can go wrong while routing by extension.
- Script
Operation - One instruction of a script.
Traits§
- Bytes
Content Parser - Turns raw file bytes into whatever a frontend works with.
- Script
Content Provider - Fetches script source by path.
- Script
Expression - The extra operations a frontend adds on top of the built-in set.
- Script
Function Generator - A backend: turns script operations into a runnable function body.
Type Aliases§
- Script
- A straight list of operations, run from first to last.
- Script
Handle - A shared, finished
Script.