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.
flags
Header flags (bit field).
trace
Trace sub-line symbols.

Structs§

ByteStorage
Storage for bytecode bytes.
Call
Call instruction for invoking definitions (recursion).
CallIR
Call instruction IR with symbolic target.
EffectIR
Effect operation with symbolic member references. Used during compilation; resolved to EffectOp during emission.
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.
Label
Symbolic reference, resolved to step address at layout time.
LayoutResult
Result of layout: maps labels to step addresses.
LineBuilder
Builder for formatted output lines.
Match
Match instruction decoded from bytecode.
MatchIR
Match instruction IR with symbolic successors.
Module
A compiled bytecode module.
NodeSymbol
Maps tree-sitter NodeTypeId to its string name.
Return
Return instruction for returning from definitions.
ReturnIR
Return instruction IR.
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.
TrampolineIR
Trampoline instruction IR with symbolic return address.
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).
TypeMetaHeader
TypeMeta section header (8 bytes).
TypeName
Maps a name to a type (4 bytes).
TypesView
View into type metadata.

Enums§

EffectOpcode
Instruction
Decoded instruction from bytecode.
InstructionIR
Pre-layout instruction with symbolic references.
MemberRef
Symbolic reference to a struct field or enum variant. Resolved to absolute member index during bytecode emission.
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.

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).