Is there a TreeVisitor for visiting expression trees in evaluation order?
-
07-11-2019 - |
質問
Using the Java Compiler Tree API, one can traverse the leaf tree of a TreePath
and its children using a TreeVisitor
.
Is there a TreeVisitor
implementation that visits all "nodes" in evaluation order? For example, if 7 - 8 * 2 + 10
were parsed as:
_____+__ / \ - 10 / \ 7 * / \ 8 2
Is there a TreeVisitor
that will visit the BinaryTree
for 8 * 2
followed by the BinaryTree
for 7 - (8 * 2)
, then the BinaryTree
for (7 - (8 * 2)) + 10
?
正しい解決策はありません
所属していません StackOverflow