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

Terence Parr parrt at cs.usfca.edu
Tue Nov 16 09:12:05 PST 2004


On Nov 15, 2004, at 7:50 PM, micheal_jor wrote:
> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
>> Ok, whew!  8 furiously written pages on visitors, tree node classes,
>> tree grammars, and action execution:
>>
>> http://www.antlr.org/article/1100569809276/use.tree.grammars.tml
>>
>> Hopefully, this is clearly written.  Regardless, it summarizes my
>> position rather thoroughly. ;)  Please send me feedback if you think
>> the article can be improved etc...
>
> Comments:
> C1. Remote attribution is cool but, does it remain useful if one
> already has a symbol table?

I feel that you do still need it.  There are many contextual things you 
need to track that are not properly stored in the symbol table.  
Further, the sym tab cannot give you a stack of values for a single 
attribute.

>
> C2. Visitors tend to be used with tree built from strongly-typed nodes
> (heterogenous nodes). Ignoring the [potential] typing issue related to
> the representation of lists of [children] nodes,  the strong typing
> enforces structural "correctness" - so explicit tree structure
> validation isn't required. You get it for free.

Yes, I really like that "correctness by construction" feature; assuming 
you can actually guarantee it.  For optional children, though, the type 
system cannot help you--you need code in the ctor for that node to 
check if the children make sense.  That's ok, but now you must have a 
tool such as TreeDL or SableCC generate the classes for you; shouldn't 
build parsers by hand. ;)

> Errata:
>
> E1. Section "Grammars as formal structure specifications" - "not"
> missing in first sentence:
> "No one will argue that building a text parser by hand should be done
> manually in most circumstances."
>
>  - should be -
>
>    "No one will argue that building a text parser by hand should not
> be done manually in most circumstances."

Fixed.

> Nice. Very clearly argued points in the article.

Thanks :)

I'll let it ride for a while and see if i can add more junk later.  
Doing just tweaks now.

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
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