On Tue, 2008-12-02 at 00:27 +0000, Diligent Warrior wrote:

> Hello everyone,
> 
> I'm working on a grammar for a Java-like language and I'm stuck at
> this one part. I'm looking to write the tree grammar from this parser
> grammar:
> 
> callExpression
>     :    (primary -> primary) (s=selector -> ^(CALL $callExpression
> $s))*
>     ;
> 
> The code would look like:
> 
> nodeObject.getLeft().getValue();
> 
> And the tree would look like:
> 
> ( CALL ( CALL nodeObject getLeft ) getValue )
> 
> ...or in other words:
> 
> ( CALL ( CALL primary selector ) selector )
> 
> Theoretically, the tree should be as deep as it needs to be.



callExpression
  : primary
  | selector
  | ^(CALL callExpression callExpression)
  ;

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