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

Oliver Zeigermann oliver.zeigermann at gmail.com
Mon Nov 22 15:27:30 PST 2004


On Mon, 22 Nov 2004 21:16:12 -0000, atripp54321 <atripp at comcast.net> wrote:
> No, because there's no mixing of code there, it's all ANTLR.
> And besides, I can (pretty much) use ANTLR without understanding
> the grammar syntax - just use the .g files that came with it.

Just for me, as I tend to be a little sluggish: You use the ANTLR
grammar (for C) and let it generate the AST? Which is something that
can be done without any idea of ANTLR... Then you access this AST and
make the translation to Java as explained in your article, right?
Well, you would at least have to know the structure of the AST, or am
I getting it all wrong again?

 > Right, but the whole point of the tree grammar is to minimize
> the amount of code that you have to write. What's the point
> of embedding 30,000 lines of code inside a 350 line grammar,
> if you could have just written 30,020 lines that do the same
> thing?

I thought it might be because of readability and maintenance. Where
you have a separation of what describes the structure (the AST
traversal notation) and what is to be done (the Java code).

> Only if a top-down walk of the tree is the basis of the
> code that you need. If your code is something else (like
> applying a series of pattern-matching rules), then
> you have to write all the code even when using a tree grammar.

I think this is a strong argument. When you think of natural language
processing (or the translation Andy does) there hardly is
one-after-the-other processing.
 
Oliver


 
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