[antlr-interest] tree transformation in Parser PLEASE

Terence Parr parrt at cs.usfca.edu
Sat Sep 10 10:45:47 PDT 2005


On Aug 26, 2005, at 6:16 AM, Gregor Pardella wrote:
>> Hello,
>>
>> maybe someone is able to help me - I become desperate.
>>
>> My parser is able to parse a statement like this one:
>>
>>   a = b = c = 4;
>>
>> and it generates a tree that looks like:
>>
>> <ROOT>
>> |_ =
>>    |_ a
>>    |_ =
>>       |_ b
>>       |_ =
>>          |_ c
>>          |_ 4

Hi Gregor,

What does your construction rule look like?  It should be:

assignment: ID EQUALS^ expr ;

or some such thing.

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list