Expand description
Intermediate Representation (IR) for compiled queries.
This module contains the in-memory representation of compiled queries as defined in ADR-0004 through ADR-0008. The IR is designed for:
- Cache-efficient execution (64-byte aligned transitions)
- Zero-copy access patterns
- WASM compatibility
Note: This module contains only type definitions. Query execution lives elsewhere.
Structs§
- Compiled
Query - A compiled query ready for execution.
- Compiled
Query Buffer - Aligned buffer for compiled query data.
- Compiled
Query Offsets - Offset metadata extracted from CompiledQuery.
- Entrypoint
- Named entrypoint into the query graph.
- MapResolver
- Map-based resolver for testing.
- Matcher
View - A view of a matcher with resolved slices.
- Nav
- Navigation instruction determining cursor movement and skip policy.
- Null
Resolver - A resolver that always fails (for testing without tree-sitter).
- Query
Emitter - Emits a compiled query from a BuildGraph.
- Slice
- Relative range within a compiled query segment.
- String
Interner - String interner for query compilation.
- String
Ref - Reference to a string in the string pool.
- Transition
- A single transition in the query graph.
- Transition
View - A view of a transition with resolved slices.
- TypeDef
- Type definition in the compiled query.
- Type
Member - Member of a Record (field) or Enum (variant).
Enums§
- Effect
Op - Effect operation in the IR effect stream.
- Emit
Error - Query emitter error.
- Matcher
- Matcher determines what node satisfies a transition.
- Matcher
Kind - Discriminant for matcher variants.
- NavKind
- Navigation kind determining movement direction and skip policy.
- RefTransition
- Marks a transition as entering or exiting a definition reference.
- Serialize
Error - Serialization error.
- Type
Kind - Discriminant for type definitions.
Constants§
- BUFFER_
ALIGN - Buffer alignment for cache-line efficiency.
- FORMAT_
VERSION - Current format version.
- HEADER_
SIZE - Header size in bytes (64 bytes for cache-line alignment).
- MAGIC
- Magic bytes identifying a compiled query file.
- MAX_
INLINE_ SUCCESSORS - Maximum number of inline successors before spilling to external segment.
- STRING_
NONE - Sentinel value for unnamed types (wrapper types have no explicit name).
- TYPE_
COMPOSITE_ START - First composite type ID (after primitives 0-2).
- TYPE_
INVALID - TYPE_
NODE - TYPE_
STR - TYPE_
VOID
Traits§
- Node
Kind Resolver - Callback for resolving node kind names to IDs.
Functions§
- align_
up - Aligns an offset up to the given alignment.
- deserialize
- Deserializes a compiled query from a reader.
- from_
bytes - Deserializes a compiled query from a byte slice.
- serialize
- Serializes a compiled query to a writer.
- to_
bytes - Serializes a compiled query to a byte vector.
Type Aliases§
- Data
Field Id - Field name in effects (alias for type safety).
- Emit
Result - Result type for emit operations.
- Node
Field Id - Node field ID from tree-sitter. Uses
NonZeroU16soOption<NodeFieldId>is the same size asNodeFieldId(niche optimization with 0 = None). - Node
Type Id - Node type ID from tree-sitter. Do not change the underlying type.
- RefId
- Index for definition references (Enter/Exit).
- Serialize
Result - Result type for serialization operations.
- String
Id - Index into the string_refs segment.
- Transition
Id - Index into the transitions segment.
- TypeId
- Index into type_defs segment (with reserved primitives 0-2).
- Variant
TagId - Variant tag in effects (alias for type safety).