[antlr-interest] Thoughts on tree construction

Mark Lentczner markl at glyphic.com
Fri May 7 12:55:54 PDT 2004


While I see the correspondence between DOM and AST, and I see the 
appeal of dividing information from a parse into attributes and 
elements, I think any real convergence is wrong.

1st: The DOM has a tremendous amount of cruft that is very XML 
specific.  None of this would be applicable to parsing.

2nd: By encoding information from a parse in both attributes and 
elements, the complexity of the structure of the AST is increased.  
Similarly, the structure of tree parsers would also have to be 
increased.  There would need to be a more complex syntax for matching 
since attributes and elements would need to be matched.

XML schema languages are precisely this sort of thing.  The results are 
a mixed bag: XML Schema does not handle attributes and elements in a 
particularly graceful way, whereas RelaxNG does a decent job of it. 
However, if one is starting from designing tree structure grammar 
parsers, I don't think attributes and elements lead to elegant or more 
expressive solutions.  XML schema languages do it because they have to.

I could imagine a DOM layer on top of the AST layer.  Then that DOM API 
could be used w/other software that works with DOM.  In this case, many 
features of the DOM would go unused (ASTs have no need for anything 
like a processing instruction...)  I can see the utility of this.  It 
could even be used to walk the AST and produce a canonical XML 
representation of it.  BUT, I don't think it means that the features of 
DOM should be integrated into AST.

	- Mark



 
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