[antlr-interest] Tree parser for large (and changing) grammars

Andy Tripp antlr at jazillian.com
Fri Feb 1 16:08:30 PST 2008


Andreas,

You're right. The tree grammar itself is redundant. It's a formal 
specification of the "shape" of the
AST produced by the parser (with the addition of your own tree-walking 
actions, of course).
Every time you make changes to the parser that affect what ASTs can be 
produced,
you most likely will break the tree grammar.

Here: http://jazillian.com/articles/treewalkers.html
are my thoughts on the subject.

Andy

Andreas Ravnestad wrote:
> Our XQuery project is moving along, and now we plan to write a tree
> parser and convert the AST into relational algebra.
>
> It seems a challenging part of the work will be to write the tree
> grammar itself. A common approach seems to be "copy & paste", however
> this creates a problem with maintainability since the rewrite rules in
> the parser grammar will change over time as we work our way through
> it.
>
> Any ideas about how to make this as painless as possible? What is your
> workflow for writing tree parser for large grammers?
>
> Thanks,
> Andreas
>
>   



More information about the antlr-interest mailing list