Glossary
The words tinyscript uses for its compiler, its images and its interpreter. How the compiler works uses each in context.
- boxing
- Converting a value from its native representation, such as a number, to a dynamic word. Unboxing is the reverse.
- case
- A grammar symbol and the steps that lower its node. The cases are also the coverage check, so the compiler accepts exactly what it has a case for.
- cell
- A heap object holding a variable that a closure captures, so the closure and its defining scope see the same value.
- driver
- A function the compiler adds to an image that needs it, implementing a protocol that calls back into the program, such as running promise jobs.
- dynamic word
- A tagged 64-bit value for a binding whose type the compiler cannot prove, such as TypeScript's
any. Numbers keep their binary64 bits; other kinds are encoded in NaN space. - effect
- A request a program makes of its host, such as a clock read or a message sent. The interpreter parks the call until the host replies.
- fragment
- A short, fixed instruction sequence declared once and generated into the compiler.
- fuel
- What the interpreter counts as it runs code, so an application can bound how long a call may run.
- image
- A compiled program: a standard WebAssembly module with tinyscript's custom sections. Standard WebAssembly tools can inspect it.
- intrinsic
- A function of the tinyscript library that compiled code imports and calls, such as reading a property. An image imports each intrinsic on its first use.
- linked image
- The image of code compiled at run time through
new Function. It is prepared beside the program that made it and cached by its text. - lowering
- Turning a function's syntax tree into the intermediate representation the compiler writes WebAssembly from.
- preparation
- The step that runs once per image before any call: it validates the module, decodes its instructions and builds register blocks. Every session running the program can share the prepared image.
- realm
- A session's globals and heap. One prepared image runs in many realms, each isolated from the others.
- register block
- A stretch of numeric code that preparation turns into a form the interpreter runs faster than the stack machine the image describes.
- representation
- How a value is stored: number, boolean, handle, dynamic or void. The compiler infers it across function calls.
- session variable
- A name the host keeps in each session, such as a data element of an SCXML chart, with a slot and a read-only flag.
- shape
- The order of an object's fields as the compiler predicts it, from TypeScript types or the host's hints. The run time checks each prediction and falls back to ordinary lookup on a miss.
- site
- The source position a call or a throw reports in an error message.
- summary
- What a function's callers need from it: the representations of its parameters and its result. The compiler compiles callees first, against their summaries.
- widening
- Giving a binding the dynamic representation and lowering its function again.
- workspace
- The one block of memory the compiler works in, which the application supplies and gets back when compilation returns.