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
<
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.