On Tue, 2008-09-30 at 09:44 +1300, David Pearce wrote:

> Hi Terence,
> 
> > Yes.  you must use
> > 
> >> list : '(' listBody ')' -> ^(LIST listBody?)
> > 
> > not
> > 
> >> list : '(' listBody ')' -> ^(LIST listBody)
> > 
> > clearly listBody can be optional, right?
> 
> Yes, in this case it is definitely optional.  But, in the Java grammar 
> case it is not:


The annotation of the grammar is not required to be the same, and is not
always the same, as the annotation of the rewrite.

Your grammar rule may not be optional, but it may or may not produce a
tree. Hence the rewrite rules needs to be told that the tree produced by
that rule may or may not be there, and you just use ->^(BLAH BLHA rule?)

Jim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to