[antlr-interest] Re: Translators Should Use Tree Grammars

micheal_jor open.zone at virgin.net
Tue Nov 23 01:42:04 PST 2004



--- In antlr-interest at yahoogroups.com, Monty Zukowski <monty at c...> wrote:

> This may have not been very efficient since I was walking and building 
> trees for every other rule even though I didn't need to.  The building 
> far outweighs the walking, and Loring has been addressing that issue 
> with his new tree code.

Does a tranforming tree parser (i.e. buildAST=true) really rebuild
every node of the tree it traverses?. Even if no explicit
transformation is specified?. I was under the impression it simply
walked it.

> I agree that pattern-matching with ANTLR grammars is not fun, because 
> you do the actual testing in actions or semantic predicates.  

You don't have to (do the testing in actions/sem_preds). You could
encode the disambiguating attributes in the tree itself. Messy though.

> The main point is that I still want to specify the order of my 
> translations.  There are some directions ANTLR could go toward making 
> the specification of translations easier, namely pattern matching and 
> substitution.

AFAIK, ANTLR's meta-langauge already supports pattern matching (on AST
structure) and substitution in tree parser grammars.

Short of additional passes, can't see how a tool like ANTLR can help
with the ordering issue. Actually, what is the issue with the ordering
of translations?

Micheal
ANTLR/C#





 
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