[antlr-interest] Grammar Problem

Jim Idle jimi at temporal-wave.com
Thu Aug 7 10:53:56 PDT 2008


On Thu, 2008-08-07 at 18:40 +0100, Henrique wrote:
> Hi guys!
> I'm having some trouble with my grammar for parsing CFA files... As I
> posted before, I'm trying to convert their Yacc grammar to ANTLR and
> now I'm having some trouble. I suspect it's the left recursions or
> rather the way I got ridden of them.
> The grammar is attached and can also be seen here.
> 
> here's the rules I'm having trouble with:
> 
> rule    :    RULE USER_STRING LEFTBRACKET buncha_replacements?
> RIGHTBRACKET
>     |    RULE USER_STRING USER_RATIONAL LEFTBRACKET
> buncha_replacements? RIGHTBRACKET
>     ;


Try

rule: RULE USER_STRING (USER_RATIONAL {set flag to say this is here or
something} )? LEFTBRACKET buncha_replacements? RIGHTBRACKET;

     Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080807/83b7d817/attachment.html 


More information about the antlr-interest mailing list