[antlr-interest] How to handle rule arguments in C
Jim Idle
jimi at temporal-wave.com
Wed Nov 10 08:28:57 PST 2010
Does your grammar specify the output=AST; option? That is usually the
problem. Also, complicate type definitions in rule parameters tend to come
unstuck, it is usually better to create typedefs the mean the declaration is
simple.
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of George Ruhlmann
> Sent: Friday, October 22, 2010 7:17 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] How to handle rule arguments in C
>
> I am using ANTLR Version 3.2 My target language is C using VC10 64-
> bit. I
> am creating a grammar called ASI.
>
> I have the rule:
>
>
> tabledata[simData::ParserAdapter *adapter]
> : 'DataTableRow' id=INT time[$adapter] values+=STRING*
> {
>
> }
> ;
> ANTLRWorks 1.4 generates the necessary files with no errors. When I
> compile the code it generates the error:
>
> 1>C:\people\feds\SIMDIS-
> X\SDK\include\GeneratedCode/src/ASIParser.c(8449):
> error C2039: 'vectors' : is not a member of 'ASIParser_Ctx_struct'
> 1>
> C:\people\feds\SIMDIS-
> X\SDK\include\GeneratedCode\include\ASIParser.h(242) :
> see declaration of 'ASIParser_Ctx_struct'
> 1>C:\people\feds\SIMDIS-
> X\SDK\include\GeneratedCode/src/ASIParser.c(8449):
> error C2227: left of '->newVector' must point to
> class/struct/union/generic type
> 1>C:\people\feds\SIMDIS-
> X\SDK\include\GeneratedCode/src/ASIParser.c(8449):
> error C2039: 'vectors' : is not a member of 'ASIParser_Ctx_struct'
> According to the book "The Definitive ANTLR Reference", the use of +=
> will place all the arguments in a list, but the C code does not know
> how to make the list object. What am I doing wrong?
>
> Thanks,
>
> George
>
> 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