[antlr-interest] Re: Tree parser question
Monty Zukowski
monty at codetransform.com
Sat May 15 08:41:22 PDT 2004
On May 14, 2004, at 4:20 PM, edcjones wrote:
> --- In antlr-interest at yahoogroups.com, "lgcraymer" <lgc at m...> wrote:
>> --- In antlr-interest at yahoogroups.com, "edcjones" <edcjones at y...>
>> wrote:
>>> In the ANTLR docs it says:
>>>
>>> For example, #( A B ) will report a match for any larger tree with
>>> the
>>> same structure such as #( A #(B C) D).
>>
>> That is, match A as root and B as first child. ANTLR does not check
>> if A or B have siblings or not, nor if B has a child.
>>
>>>
>>> Will #( A B ) report a match for #(A D #(B C))?
>>
>> No.
>>
> So B must be the first child.
>
> What is the difference between these two rules? What will the rules
> match?
>
The first one matches a "struct" node with a child tree which will
match structOrUnionBody. The second has structOrUnionBody as a
sibling, not a child.
> structSpecifier
> : #( a:"struct" structOrUnionBody )
> ;
>
> structSpecifier
> : "struct" structOrUnionBody
> ;
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Monty Zukowski
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
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/
More information about the antlr-interest
mailing list