Skip to content

Conversation

@zharinov
Copy link
Member

@zharinov zharinov commented Jan 3, 2026

Summary

Add a runtime VM engine that executes compiled bytecode against tree-sitter ASTs and produces JSON output.

Components

Engine core (engine/):

  • vm.rs - Virtual machine with backtracking support
  • cursor.rs - TreeCursor wrapper with Plotnik navigation semantics
  • checkpoint.rs - Checkpoints for backtracking
  • frame.rs - Call frame arena for recursion
  • effect.rs - Runtime effects (Node, Arr, Obj, etc.)
  • materializer.rs - Effect stream → JSON value conversion
  • value.rs - JSON value types and serialization
  • trace.rs - Execution trace for debugging
  • error.rs - Runtime error types

Bug fixes (compile/):

  • Fix scalar array captures producing nulls (missing Node+Push effects)
  • Fix recursive patterns flattening captures (missing Obj/EndObj scopes)

Tests

23 snapshot-based tests covering captures, quantifiers, alternations, recursion, anchors, fields, and regression cases.

Test plan

  • All 704 tests pass
  • Clippy passes

@zharinov zharinov enabled auto-merge (squash) January 3, 2026 12:18
@zharinov zharinov merged commit a6ffa7b into master Jan 3, 2026
4 checks passed
@zharinov zharinov deleted the feat/engine branch January 3, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants