Hi,
I'm trying to use flex and bison to create a filter, because I want get certain grammar elements from a complex language. My plan is to use flex + bison to recognize the grammar, and dump out the location of elements of interest. (Then use a script to grab text according the locations dumped.)
I found flex can support a bison feature called bison-locations, but how it works in exactly. I tried the example in flex document, it seems the yylloc is not set automatically by flex, I always get (1,0)-(1,0). Could flex calculate each token's location automatically? If not, what interface function is defined for me to implement? Is there any example?
Any better solution regarding to tools?
Best Regards, Kevin
Now the interface for yylex turn to:
int yylex(YYSTYPE * yylval_param,YYLTYPE * yylloc_param );
bison manual does not specify how lexer should implement to correctly set yylloc_param. For me it is hard to manually trace column number of each token.