[antlr-interest] Tree construction in Antlr

Sergei Smolov ssedai at gmail.com
Fri May 14 07:10:28 PDT 2010


Hello, everybody!
I have a very simple question. For example, I have the following grammar
rule:

FirstToken : Second Third;

And I want to generate the following tree from such rule (I mean Tree in
Java terms):

        FirstToken
        /           \
 Second      Third

How should I rewrite my grammar rule? As far, as I understand, I can use '^'
and '!' operators for it. But I don't understand how to make First Token a
root of this tree.

Thanks in advance

-- 
Sergey Smolov


More information about the antlr-interest mailing list