Module bytecode

Module bytecode 

Source
Expand description

Bytecode module for compiled Plotnik queries.

Implements the binary format specified in docs/binary-format/.

Modules§

cols
Column widths for instruction line formatting.
trace
Trace sub-line symbols.

Structs§

AlignedVec
Immutable 64-byte aligned byte storage.
Call
Call instruction for invoking definitions (recursion).
EffectOp
Entrypoint
Named query definition entry point (8 bytes).
EntrypointsView
View into entrypoints.
FieldSymbol
Maps tree-sitter NodeFieldId to its string name.
Header
File header - first 64 bytes of the bytecode file.
LineBuilder
Builder for formatted output lines.
Match
Match instruction decoded from bytecode.
Module
A compiled bytecode module.
NodeSymbol
Maps tree-sitter NodeTypeId to its string name.
RegexView
View into the regex table for lazy DFA lookup.
Return
Return instruction for returning from definitions.
SectionOffsets
Computed section offsets derived from header counts.
Slice
Range into an array: [ptr..ptr+len).
StepId
Successor step address in decoded instructions.
StringId
Index into the String Table.
StringsView
View into the string table for lazy string lookup.
Symbol
Symbols for the 5-character symbol column.
SymbolsView
View into symbol tables (node types or field names).
Trampoline
Trampoline instruction for universal entry.
TriviaEntry
A node type ID that counts as trivia (whitespace, comments).
TriviaView
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.
TypeMember
Field or variant entry (4 bytes).
TypeName
Maps a name to a type (4 bytes).
TypesView
View into type metadata.

Enums§

ByteStorage
Storage for bytecode bytes with guaranteed 64-byte alignment.
EffectOpcode
Instruction
Decoded instruction from bytecode.
ModuleError
Module load error.
Nav
Navigation command for VM execution.
NodeTypeIR
Node type constraint for Match instructions.
Opcode
Instruction opcodes (4-bit).
TypeData
Structured view of TypeDef data, eliminating the need for Option-returning accessors.
TypeKind
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§

StepAddr
Step address in bytecode (raw u16).