[antlr-interest] How to handle rule arguments in C
George Ruhlmann
george.ruhlmann at gmail.com
Fri Oct 22 07:16:46 PDT 2010
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
More information about the antlr-interest
mailing list