[cfe-dev] new design of RecursiveASTVisitor

Zhanyong Wan (λx.x x) wan at google.com
Sat Jun 5 00:13:22 PDT 2010


Thanks for the comments.

On Sat, Jun 5, 2010 at 12:01 AM, Abramo Bagnara
<abramo.bagnara at gmail.com> wrote:
>
> For proper implementation of tree finite automata I'd suggest you to
> consider the (needed) distinction from node entering and node exiting.
>
>  call Enter node handler;
>  visit node childs;
>  call Exit Node handler;

This is beyond the scope of what I'd like to do now.  The generality
you proposed can be useful (e.g. for implementing postorder
traversal), but all the use cases I have in mind only need preorder
traversal (as stated in my design goal).  Note that the "exit node
handler" can always be added later without breaking existing clients,
so we can incorporate your proposal later, when there's actual need
for it.

> Another very useful thing you should consider is to add a child
> identifier to handler arguments that inform handler about *which* parent
> child is currently visited: this information is not otherwise deducible.

Sorry, I don't understand what you mean by "which parent child is
currently visited".  Care to clarify?

> To better understand this try to imagine an application that want to
> check lhs of assign binary operator.

-- 
Zhanyong




More information about the cfe-dev mailing list