[antlr-interest] ANTLR 3 tree structure stuff

Terence Parr parrt at cs.usfca.edu
Wed Nov 10 10:51:23 PST 2004


On Nov 10, 2004, at 12:28 AM, Oliver Zeigermann wrote:
> I know there has been a discussion about this some time ago, but could
> you explain this for me once more, please?
>
> I thought if you translated (traversed) DOMs instead of ASTs as well
> what what be the difficulty if they have some incompatible method
> signatures?

You can't parse a DOM tree as the type is wrong.  ANTLR expects to walk 
AST, but DOM isn't a subtype so it can't compile.

>  The DOM objects certainly won't implement the AST
> interface, will they?

No but we could make an interface that combined AST and DOM called 
DOMAST and then ANTLR could walk them :)

>  Wouldn't you need different code for both
> traversals anyway as the DOM does not have any integer type
> information.

Oh really?  Is it just a string?  Well, I guess you could subclass dom 
and make it implement DOMAST.

>  Additionally it has attributes along with elements and
> encodes a document only. Having said this it seems DOM and AST are
> semantically incompatible, so why bother on the signature level?

Well, you know WAY more about this than I do so I'll just drop the DOM 
requirement :)

> Most likely I got everything wrong again, and if so would you please
> explain how it really is supposed to work?

Nope, you are almost certainly correct :)

Ter
>
> Thanks,
>
> Oliver
>
> On Tue, 9 Nov 2004 14:52:06 -0800, Terence Parr <parrt at cs.usfca.edu> 
> wrote:
>>
>>
>> On Nov 9, 2004, at 2:00 PM, Oliver Zeigermann wrote:
>>
>>>
>>> This looks reasonable to me. However, I was wondering why are you so
>>> eager to be compatible to the DOM?
>>
>> I just wanted to be able to parse DOM trees.
>>
>>
>>
>> Ter
>> --
>> CS Professor & Grad Director, University of San Francisco
>> Creator, ANTLR Parser Generator, http://www.antlr.org
>> Cofounder, http://www.jguru.com
>> Cofounder, http://www.knowspam.net enjoy email again!
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
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