[antlr-interest] init bug

Ivan Brezina ibre5041 at ibrezina.net
Mon Nov 7 07:18:33 PST 2011


Quoting yushang <yusunn at gmail.com>:

Look at @declarations in ANTLR syntax.

Ivan
PS: I have asked the same question about month ago.

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



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the antlr-interest mailing list