[antlr-interest] Delimited identifiers and suffix functions

John B. Brodie jbb at acm.org
Mon Dec 12 10:07:51 PST 2005


>I am having a problem with parser nondeterminism between alt 1 and the
>exit branch of the following rule (simplified)...
>
>member : identifier (DOT identifier)*
>	   (DOT LASTCHILD
>	 | DOT LAG OPEN_PAREN index CLOSE_PAREN)*
>       ;
>
>I want to successfully parse the following types of members...
>
>ident0.ident1.ident2.identN
>ident0.ident1.ident2.identN.lastchild
>ident0.ident1.ident2.identN.lastchild.lag(1)
>
>
>Any ideas?


untested but perhaps something similar to:

member : identifier ( member_tail )? ;

member_tail : DOT ( (identifier (member_tail)? ) | another_tail )

another_tail :
      (LASTCHILD | (LAG OPEN_PAREN index CLOSE_PAREN)) (DOT another_tail)? 
    ;



hope this helps...
   -jbb


More information about the antlr-interest mailing list