Traditional AST parsers (like Tree-sitter) are highly optimized for context-free syntax, but they are fundamentally blind to dynamic runtime environments (e.g., metaprogramming, macros, dynamic evaluations).
SymbIONet is a Python-based proof-of-concept that bridges this gap. It combines traditional deterministic syntax trees with localized, predictive inference routines to map hidden runtime structures before execution.
- Symbolic Phase: Maps explicit definitions using deterministic AST trees.
- Boundary Detection: Flags structural dynamic code expressions (like injection loops).
- Inference Phase: Uses a simulated execution-inference engine to calculate the resulting runtime objects and appends them as virtual tokens to the AST.
git clone https://github.com/aditya-8108/symbionet.git
cd symbionet
python3 engine.pySymbIONet is designed to handle complex runtime scope tracking that traditional deterministic parsers miss. For example, consider this dynamic boundary where constants are splatted and evaluated inside an iteration block:
class Foo
LIST_1 = [:bar, :baz]
LIST_2 = [:qux, *LIST_1]
LIST_2.each do |name|
define_method(name) do
puts "hello"
end
end
end- Synchronous Fast-Path: The static parser maps class
Fooinstantly on the main thread. - Boundary Isolation: The engine detects
define_method(name)is receiving a non-literal variable and flags theLIST_2.eachblock as a dynamic boundary. - Asynchronous Inference: The isolated boundary—along with its local constant dependencies (
LIST_1,LIST_2)—is routed to the background inference worker. - Virtual Node Injection: The worker evaluates the array splat (
[:qux, :bar, :baz]), predicts the three resulting runtime signatures, and injectsDefNode(:qux),DefNode(:bar), andDefNode(:baz)back into theFooAST scope.
This allows the editor to maintain sub-millisecond responsiveness while asynchronously resolving highly dynamic metaprogramming boundaries.