[antlr-interest] Problem with C target output on example C grammar

Jim Idle jimi at temporal-wave.com
Wed Apr 2 12:10:35 PDT 2008


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Kamil Burzynski
> Sent: Wednesday, April 02, 2008 11:15 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Problem with C target output on example C
> grammar
> 
> 
> evaluate
> scope A;
> scope B;
> scope C;
> @init
> {
>         printf("\%p \%p \%p\n", SCOPE_TOP(A), SCOPE_TOP(B),
> SCOPE_TOP(C) );
>         $A::a = 42;
>         $B::b = 42;
>         $C::c = 42;
> }
> : 'foo';


Sorry, this turns out to be user error after all ;-(. That is good really as it means that you can fix your grammar without needing any patches. You should get an error from ANTLR but such errors are a little lacking in this version and will improve once ANTLR 3 is using an ANTLR3 parser.

The syntax is:

evaluate

  scope A B C;

: .....


And then everything should be fine.

Jim





More information about the antlr-interest mailing list