[antlr-interest] init bug

yushang yusunn at gmail.com
Mon Nov 7 05:26:10 PST 2011


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


More information about the antlr-interest mailing list