help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tracking location in bison


From: Emmanuel.Wauters
Subject: tracking location in bison
Date: Fri, 23 Aug 2002 11:39:20 +0200

 
How to use bison to track the position in rules ?
I've tried the example from the bison 1.35 manual (Location Tracking Calculator ltcalc)
( Location Tracking Calculator: ltcalc ) but it always gave me zero's for the @-values.
 
When I insert the #define YYSTYPE int
I get the following :
bison -v -d micro.y
gcc -Wall -g   -c -o micro.tab.o micro.tab.c
micro.y: In function `yyparse':
micro.y:127: request for member `idx' in something not a structure or union
micro.y:130: request for member `idx' in something not a structure or union
micro.y:135: request for member `idx' in something not a structure or union
micro.y:136: request for member `idx' in something not a structure or union
micro.y:143: request for member `idx' in something not a structure or union
micro.y:169: request for member `idx' in something not a structure or union
micro.y:169: request for member `idx' in something not a structure or union
micro.y:198: request for member `value' in something not a structure or union
micro.y:202: request for member `idx' in something not a structure or union
micro.y:209: request for member `idx' in something not a structure or union
micro.y:212: request for member `idx' in something not a structure or union
micro.y:215: request for member `idx' in something not a structure or union
micro.y:215: request for member `idx' in something not a structure or union
make: *** [micro.tab.o] Error 1
 
This is the rule where 127 belongs to :
 
declaration     : DECLARE NAME
                        {
                        if (symbol_declared($2))
                                {fprintf(stderr,"line_%pcolumn_%d_%d_%d:",@1.first_line,             @1.first_column,@1.last_line,@1.last_column);
fprintf(stderr,"Variable \"%s\" already declared (line %d)\n",
                                                symbol_name($2),lineno);
                                exit(1);
                                }
                        else
                                {
                                printf("\tint\t\t%s\n",symbol_name($2));
                                symbol_declare($2);
                                }
                        }
                ;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]