[antlr-interest] Difficulty building trees

Maassen, H.A.M. H.A.M.Maassen at student.tue.nl
Mon Nov 1 06:17:18 PST 2004


Thanks the helpful tips on visualizing trees - the ASTFrame is a nice debugging tool.

It turns out that the difficulties I had in visualizing trees were because I hadn't defined a tree structure in my grammar - I thought that ANTLR assumed one and that the operators such as the "^" were for overriding the default where in fact they seem to be required.

So right now I'm having some problems getting the following to work:

program: rule rule rule;     //or: (rule)*
rule: "a";

The resulting AST seems to only have the encompass "rule". How would I go about fixing it so that my AST would look something like this:

program
|_ rule
|   |_ "a"
|_ rule
|   |_ "a"
|_ rule
    |_ "a"

or, alternatively:

program
|_ "a"
|_ "a"
|_ "a"

Thanks for any help, 
                   Harald Maassen



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4010 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20041101/82f94cd9/attachment.bin


More information about the antlr-interest mailing list