Crate plotnik_lib

Crate plotnik_lib 

Source
Expand description

Plotnik: Query language for tree-sitter AST with type inference.

§Example

use plotnik_lib::Query;

let source = r#"
    Expr = [(identifier) (number)]
    (assignment left: (Expr) @lhs right: (Expr) @rhs)
"#;

let query = Query::try_from(source).expect("out of fuel");
eprintln!("{}", query.diagnostics().render(query.source_map()));

Re-exports§

pub use plotnik_bytecode as bytecode;

Modules§

analyze
Semantic analysis passes.
colors
ANSI color codes for terminal output.
compile
Thompson-like NFA construction for query compilation.
diagnostics
emit
Bytecode emission from compiled queries.
engine
Runtime engine for executing compiled Plotnik queries.
parser
Parser infrastructure for the query language.
query
Query facade for Plotnik compilation.
type_system
Core type system definitions shared between analysis and bytecode.
typegen
Type declaration generation from compiled bytecode.

Macros§

include_query_aligned
Embed bytecode with 64-byte alignment (zero-copy loading).

Structs§

Colors
ANSI color palette for CLI output.
Diagnostics
DiagnosticsPrinter
EffectLog
Effect log with truncation support for backtracking.
FuelLimits
Runtime limits for query execution.
NodeHandle
Lifetime-free node handle for output.
PrintTracer
Tracer that collects execution trace for debugging.
QueryBuilder
SourceId
Lightweight handle to a source in a compilation session.
SourceMap
Registry of all sources.
Span
A location that knows which source it belongs to.
VM
Virtual machine state for query execution.
ValueMaterializer
Materializer that produces Value with resolved strings.

Enums§

Error
Errors that can occur during query parsing.
RuntimeEffect
Runtime effect produced by VM execution.
RuntimeError
Errors during VM execution.
Severity
Value
Self-contained output value.
Verbosity
Verbosity level for trace output.

Traits§

Materializer
Materializer transforms effect logs into output values.
Tracer
Tracer trait for VM execution instrumentation.

Functions§

debug_verify_type
Debug-only type verification.

Type Aliases§

PassResult
Result type for analysis passes that produce both output and diagnostics.
Query
Result
Result type for query operations.