Expand description
Bytecode module for compiled Plotnik queries.
Implements the binary format specified in docs/binary-format/.
Modules§
Structs§
- Aligned
Vec - Immutable 64-byte aligned byte storage.
- Call
- Call instruction for invoking definitions (recursion).
- Effect
Op - Entrypoint
- Named query definition entry point (8 bytes).
- Entrypoints
View - View into entrypoints.
- Field
Symbol - Maps tree-sitter NodeFieldId to its string name.
- Header
- File header - first 64 bytes of the bytecode file.
- Line
Builder - Builder for formatted output lines.
- Match
- Match instruction decoded from bytecode.
- Module
- A compiled bytecode module.
- Node
Symbol - Maps tree-sitter NodeTypeId to its string name.
- Regex
View - View into the regex table for lazy DFA lookup.
- Return
- Return instruction for returning from definitions.
- Section
Offsets - Computed section offsets derived from header counts.
- Slice
- Range into an array: [ptr..ptr+len).
- StepId
- Successor step address in decoded instructions.
- String
Id - Index into the String Table.
- Strings
View - View into the string table for lazy string lookup.
- Symbol
- Symbols for the 5-character symbol column.
- Symbols
View - View into symbol tables (node types or field names).
- Trampoline
- Trampoline instruction for universal entry.
- Trivia
Entry - A node type ID that counts as trivia (whitespace, comments).
- Trivia
View - View into trivia entries.
- TypeDef
- Type definition entry (4 bytes).
- TypeId
- Index into the Type Definition table. All types (including builtins) are stored sequentially in TypeDefs.
- Type
Member - Field or variant entry (4 bytes).
- Type
Name - Maps a name to a type (4 bytes).
- Types
View - View into type metadata.
Enums§
- Byte
Storage - Storage for bytecode bytes with guaranteed 64-byte alignment.
- Effect
Opcode - Instruction
- Decoded instruction from bytecode.
- Module
Error - Module load error.
- Nav
- Navigation command for VM execution.
- Node
TypeIR - Node type constraint for Match instructions.
- Opcode
- Instruction opcodes (4-bit).
- Type
Data - Structured view of TypeDef data, eliminating the need for Option-returning accessors.
- Type
Kind - Semantic type kinds.
Constants§
- MAGIC
- Magic bytes identifying a Plotnik bytecode file.
- MAX_
MATCH_ PAYLOAD_ SLOTS - Maximum payload slots for Match instructions.
- MAX_
PRE_ EFFECTS - Maximum pre-effects per Match instruction.
- SECTION_
ALIGN - Section alignment in bytes.
- STEP_
SIZE - Step size in bytes (all instructions are 8-byte aligned).
- VERSION
- Current bytecode format version. v2: Removed explicit offsets (computed from counts), added regex section. v3: Removed flags field (unlinked mode).
Functions§
- align_
to_ section - Pad a size to the next multiple of SECTION_ALIGN (64 bytes).
- dump
- Generate a human-readable dump of the bytecode module.
- format_
effect - Format an effect operation for display.
- nav_
symbol - Format navigation command as a Symbol using the doc-specified triangles.
- select_
match_ opcode - Select the smallest Match variant that fits the given payload.
- superscript
- Convert a number to superscript digits.
- truncate_
text - Truncate text to max length with ellipsis.
- width_
for_ count - Calculate minimum width needed to display numbers up to
count - 1.
Type Aliases§
- Step
Addr - Step address in bytecode (raw u16).