This has an example of how to go down the AST and then back up.

http://www.antlr.org/wiki/display/ANTLR3/Tree+pattern+matching

This is a concrete example of the method on the wiki. I used it in my
experiment about learning how to make an interpreter. EveCore calls the
downup method. The .g file is the grammar, of course.

https://github.com/ProjectMoon/eve2/blob/master/src/eve/core/EveCore.java#L227
https://github.com/ProjectMoon/eve2/blob/master/src/eve/core/ASTParser.g

On Thu, Aug 4, 2011 at 3:48 PM, <[email protected]> wrote:

> Hello- I'm working on a grammar that has nested subtrees. I am successfully
> parsing the input to create the AST, but am having trouble navigating the
> tree to build the structure my Java program needs. The output is a
> HashMap<String,Object>.  When it's not a leaf node, the Object in the map
> will be a HashMap<String,Object>. Can you point me to some examples of more
> complicated tree walkers than the ones I've been able to find? I have been
> though the video tutorial as well. Thanks in advance.
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to