« Return to Thread: what's the different between DepthFirsitVisitor and DepthFirstTransformer

Re: what's the different between DepthFirsitVisitor and DepthFirstTransformer

by Marcus Griep-3 :: Rate this Message:

Reply to Author | View in Thread

As the names suggest, the DepthFirstVisitor visits all nodes in the
CompileUnit or Node that you give it, but doesn't deal with
modifications to the AST.  It is most often used with style checking or
annotative functions.

The DepthFirstTransformer visits all nodes in the CompileUnit or Node
you give it and can handle additions to and removals from the AST.  It
is used by macro expanders and ast attributes among others.

Both can be subclassed and overridden to do whatever you'd like to do,
and can even cull out entire portions of the tree (for example, if you
are making a visitor that works with structs and don't care about what
happens in a class, you can ensure the visitor doesn't enter classes).

Eric wrote:
> i can't distinguish between them
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
> To post to this group, send email to boolang@...
> To unsubscribe from this group, send email to boolang-unsubscribe@...
> For more options, visit this group at http://groups.google.com/group/boolang
> -~----------~----~----~----~------~----~------~--~---
>
>  

--
Marcus Griep
GPG Key ID: 0x5E968152
——
http://www.boohaunt.net
את.ψο´




signature.asc (809 bytes) Download Attachment

 « Return to Thread: what's the different between DepthFirsitVisitor and DepthFirstTransformer

LightInTheBox - Buy quality products at wholesale price!