[antlr-interest] init bug
Jim Idle
jimi at temporal-wave.com
Mon Nov 7 09:51:16 PST 2011
Please read the API docs for C.
However:
rule
@declarations
{
int flag;
}
@init
{
flag = 0;
}
: X T
;
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of yushang
> Sent: Monday, November 07, 2011 5:26 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] init bug
>
> Hi , everyone,
> I found varibale put in init section will raise compiler error , for
> example test @init{ int flag=0; }
> : expr -> ^(EXPR expr)
> ;
> will generate following code fragment
> ...
> root_0 = NULL;
> int flag = 0;
> ...
> this will be error by C compiler , because C language do not allow
> variable declaration middle of block.
> BTW I'm using ANTLR v3.4 and C runtime v3.4 Many thanks
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address
More information about the antlr-interest
mailing list