[antlr-interest] Re: Translators Should Use Tree Grammars
atripp54321
atripp at comcast.net
Tue Nov 23 08:47:13 PST 2004
--- In antlr-interest at yahoogroups.com, "Alexey Demakov" <demakov at i...>
wrote:
> > > > I don't want to "walk the tree", I want to "search the tree for
> > patterns
> > > > and make replacements".
> > >
> > > That's exactly what a tree walker gives you.
> >
> > But only matching at a particular point in the walking of the
> > tree, right? In other words, I can't just say "match this pattern
> > anywhere in the AST", I have to put the pattern at a particular
> > place in the grammar (or put that action at each and every
> > node in the grammar). Or Am I missing something?
>
> But if this pattern contains some node reference, it can be placed
> only in particular place in grammar - where that node is referenced :)
> And I think that most of reasonable patterns are linked to some node...
Yea, you're right, almost every pattern-matching rule
should probably only match at a certain point in the grammar.
I don't like having to figure out where that point is for
every rule (I'd rather just let the runtime churn a bit), but
maybe I'm just too lazy :)
Andy
>
> Regards,
> Alexey
>
> -----
> Alexey Demakov
> TreeDL: Tree Description Language: http://treedl.sourceforge.net
> RedVerst Group: http://www.unitesk.com
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