Hi,

Jim Idle schrieb:
> Do you really mean that, or do you mean:
>
> (type (ASSIGN expression)?) ( COMMA type (ASSIGN expression)?)*
>   
Well that's even more fancy but I settle for the simpler variant for now :)
> However, it looks like your simpleVariable and listVariable need left 
> factoring (bring all the common things in to one rule and branch alts 
> where they differ.
>   
Yes you're right. Somehow I didn't see the wood for the trees, thank you 
for pointing me into the right direction, the solution is actually quite 
simple:

variableDeclaration
    :    type ID ( ASSIGN expression )?
        ->     ^(VAR_DEF ID type)
            ^(ASSIGN ID expression)?
    |    type first=ID ( COMMA other+=ID )+ ( ASSIGN expression )?
        ->     ^(VAR_DEF ID type)+
            ^(ASSIGN $first expression)?
            ^(ASSIGN $other $first)*
    ;

Thanks,

Stefan


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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to