Hi,
I'm trying to store something similar to an abstract syntax tree and query against it to get simplest hints about where a symbol is defined.
For example, for the ruby codes
class A
def self.b
end
end
A.b
I'm storing the follow graph:
(root)-[:defs]->('A')-[:defs]->('b')
|
+-->[:refs]->('A')-[:refs]->('b')
so when given the second ('b') vertex, my program should
1 push ([:refs], ('b‘)) in an immutable stack S
2 push ([:refs], ('A')) into S
3 match S.top (which is ([:refs], ('A')) against ([:defs], ('A')). We found a pair of define/reference with the same identifier name so pop S and pass poped S to later step.
4 match S.top ([:refs], ('b')) against ([:defs], ('b')), pop S. S is empty so we know A.b is defined in A.
Sorry for the long description. In short, I'm trying to traverse through a DAG while [1] keeping knowledge of previously visited vertices and edges in an immutable stack, [2]filter later steps according to this knowledge, and [3] occasionally pass a difference stack to deeper traversals.
I wasn't aware of the existene of the .process route operation before. It seems promising, can it be used to dynamically define sections?
And, would I ask for some recommendations about my use case?
Thanks.