yylloc undefined in this scope

后端 未结 1 1538
悲&欢浪女
悲&欢浪女 2021-01-25 11:01

I have the following problem while compiling the files. I have overwritten the definition of YYLTYPE as follows(though it is the same as default but I will extend it

<         


        
相关标签:
1条回答
  • 2021-01-25 11:39

    You need to put the definition of YYLTYPE and YYLTYPE_IS_DECLARED into a header file that you #include in both your .y and .l files, and you need to #include the .tab.h file in your .l file AFTER the #include of the file that defines YYLTYPE.

    The reason for the above is that bison DOES NOT export your definition of YYLTYPE from the top of your .y file, so if you want it somewhere else, you need to arrange that it be available. Worse, the .tab.h file will always have the default YYLTYPE (guarded by #ifndef YYLTYPE_IS_DECLARED) so you need to ensure that your definition is seen before it.

    0 讨论(0)
提交回复
热议问题