[antlr-interest] Re: getFirstChild vs getNextSibling ?

Terence Parr parrt at jguru.com
Sat May 3 08:47:38 PDT 2003


Hi gang,

Imagine tree

A
|
|
B -- C

getFirstChild of A is B, of B is null, of C is null.
getNextSibling of A is null, of B is C, of C is null.

Terence

On Saturday, May 3, 2003, at 08:38  AM, jw9315 wrote:

> Hi,
> so what type of tree structures have a nextSibling()of null, because
> I can always get the firstChild, but calls to getNextSibling always
> return null?
> Thanks,
> Jon
>
> of null
>
> --- In antlr-interest at yahoogroups.com, ow <oneway_111 at y...> wrote:
>> --- jw9315 <jw9315 at b...> wrote:
>>> Hi,
>>> I writing a very simple interpreter using an AST tree. I know
> this is
>>>
>>> probably a trivial question, but what is the difference between
> the
>>> calls astTree.getFirstChild() vs astTree.getNextSibling()? Could
>>> anyone give me a short example, it would be much appreciated!
>>> Thanks,
>>> Jon
>>
>> The way I see it:
>>
>> AST parent
>>         +
>>         |
>>         |--- firstChild = parent.getFirstChild()
>>         |
>>         |--- nextSibling = firstChild.getNextSibling()
>>
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> The New Yahoo! Search - Faster. Easier. Bingo.
>> http://search.yahoo.com
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list