[antlr-interest] summary of trip to Montreal/SableCC land

Terence Parr parrt at cs.usfca.edu
Mon Nov 15 07:32:21 PST 2004



On Nov 15, 2004, at 7:09 AM, Alexey Demakov wrote:

>
> From: "Terence Parr" <parrt at cs.usfca.edu>
>> ... As for
>> tree construction, he builds trees that are "type safe"; that is, they
>> conform to a particular structure specified in a "tree grammar"
>> section.
>
> 561 generated files in 'node' package for Java 1.1 and
> 409 for Simple C - imho, trees generated by SableCC are not very handy.

Yep, I don't like the visitor mechanism as I discussed with Etienne 
and, like jjtree for javacc, I don't like generating a class per node.  
That is pretty gross.  First, people are so in love with objects that 
EVERYTHING must be a class.  It's amazing we got any work done before 
oo, right? ;)  Also, when doing translations, it is the tree structure 
that is important.  Occasionally, you need special info at particular 
nodes, but this is really just a set of attributes (mitchell is saying 
this should be a dynamic list like HashMap or something).  You do NOT 
need to make this a separate object type just to access an overridden 
method like "action()" because it is the action location in the grammar 
that gives you the proper "event trigger".  It has context (where it 
lives in a rule) and you can have actions communicate easily whereas 
visitor actions are like "incommunicato islands".  This is why Etienne 
particularly liked my dynamically-scoped attributes thingy (although I 
think I need to give Gary Funck credit; he asked for these back in my 
SORCERER days a decade ago--i think he has trouble remembering if he 
invented them).  Visitors find it VERY difficult to pass in context; 
can't use parameters, right?  You'd have to make each action method 
have the combined set of parameters you need to pass.

Anyway, I should really flesh all this out in an article--and describe 
why you need tree grammars more to get people using them.  First, I 
suppose I need to get a less buggy tree parser going ;)

Ter





 
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