-
Hi, I was wondering, during the parsing of the string one creates an AST. I was wondering if there was an easy way to extract the rules that generated a specific AST from a specific order traversal ? (note: non-terminals be expanded in different orders e.g. BFS or DFS so the sequence would correspond to such an ordering)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 33 replies
-
There is the If that does not do what you want, you will need to provide an example of what you want. Potentially the internal Note that if you want to match how it is parsed in reverse, that doesn't really make sense since we are implementing different algorithms that don't directly walk the grammar in a tangible way. |
Beta Was this translation helpful? Give feedback.
There is the
Transformer
,Visitor
andInterpreter
classes that visit the nodes of the tree.If that does not do what you want, you will need to provide an example of what you want. Potentially the internal
tree_matcher
does what you want.Note that if you want to match how it is parsed in reverse, that doesn't really make sense since we are implementing different algorithms that don't directly walk the grammar in a tangible way.