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
- Diagnostics
Printer - Effect
Log - Effect log with truncation support for backtracking.
- Fuel
Limits - Runtime limits for query execution.
- Node
Handle - Lifetime-free node handle for output.
- Print
Tracer - Tracer that collects execution trace for debugging.
- Query
Builder - Source
Id - Lightweight handle to a source in a compilation session.
- Source
Map - Registry of all sources.
- Span
- A location that knows which source it belongs to.
- VM
- Virtual machine state for query execution.
- Value
Materializer - Materializer that produces Value with resolved strings.
Enums§
- Error
- Errors that can occur during query parsing.
- Runtime
Effect - Runtime effect produced by VM execution.
- Runtime
Error - 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§
- Pass
Result - Result type for analysis passes that produce both output and diagnostics.
- Query
- Result
- Result type for query operations.