|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
prologue not in y.tab.h with bison 2.4.1Dear All! I have a small project, with the following setup: parser.y: %{ #define THIS foo #define THAT bar %} %% /* ... snip ... */ lexer.c: #include "y.tab.h" int yylex(void) { THIS; THAT; } In short, the lexer uses definitions from the prologue of the parser file (lexical tie-ins and some macros). This used to work, as bison used to include the prologue section in the y.tab.h file. I noticed, that with bison 2.4.1 this is no longer the case and this broke my setup. I know that it can be fixed in several ways, but I thought I would first ask if this is intentional and will remain so in the future versions of bison. I've looked at the changelogs but didn't find any warnings about this case, so is this the intended behavior? regards Istvan Sandor _______________________________________________ help-bison@... http://lists.gnu.org/mailman/listinfo/help-bison |
|
|
Re: prologue not in y.tab.h with bison 2.4.1On Fri, 6 Nov 2009, sandori@... wrote:
> In short, the lexer uses definitions from the prologue of the parser > file (lexical tie-ins and some macros). This used to work, as bison used > to include the prologue section in the y.tab.h file. I noticed, that > with bison 2.4.1 this is no longer the case and this broke my setup. I > know that it can be fixed in several ways, but I thought I would first > ask if this is intentional and will remain so in the future versions of > bison. > > I've looked at the changelogs but didn't find any warnings about this > case, so is this the intended behavior? What Bison release were you using previously? What skeletons are you using? If the answer is 2.3 or earlier with C++ or GLR skeletons, then see the 2.3a entry in NEWS. This change is permanent and intentional. In hindsight, it has caused backward compatibility problems for too many users, but many users have now adjusted, so it's too late to revert. I apologize for the trouble. In any case, I recommend you switch to the %code directive. For a discussion of why it's better, see the "Prologue Alternatives" section in the Bison manual. Ignore the documentation that says it's an experimental feature. For C/C++, we have already removed the experimental label for the coming 2.4.2 release. _______________________________________________ help-bison@... http://lists.gnu.org/mailman/listinfo/help-bison |
|
|
Re: prologue not in y.tab.h with bison 2.4.1On Fri, Nov 06, 2009 at 10:38:19AM -0500, Joel E. Denny wrote:
> What Bison release were you using previously? What skeletons are you > using? If the answer is 2.3 or earlier with C++ or GLR skeletons, then > see the 2.3a entry in NEWS. This change is permanent and intentional. > In hindsight, it has caused backward compatibility problems for too many > users, but many users have now adjusted, so it's too late to revert. I > apologize for the trouble. I was using 2.3 (with glr), I'll have a look at the NEWS, thanks for pointing it out. And I'll adjust my setup then to work both with 2.3 and 2.4 :-) regards Istvan _______________________________________________ help-bison@... http://lists.gnu.org/mailman/listinfo/help-bison |
|
|
Re: prologue not in y.tab.h with bison 2.4.1On Fri, 6 Nov 2009, sandori@... wrote:
> On Fri, Nov 06, 2009 at 10:38:19AM -0500, Joel E. Denny wrote: > > What Bison release were you using previously? What skeletons are you > > using? If the answer is 2.3 or earlier with C++ or GLR skeletons, then > > see the 2.3a entry in NEWS. This change is permanent and intentional. > > In hindsight, it has caused backward compatibility problems for too many > > users, but many users have now adjusted, so it's too late to revert. I > > apologize for the trouble. > > I was using 2.3 (with glr), I'll have a look at the NEWS, thanks for > pointing it out. And I'll adjust my setup then to work both with 2.3 and > 2.4 :-) It sounds like you already know this, but I should point out for the record that %code was not available in 2.3. Thus, projects that need compatibility with 2.3 and later will have to manually copy the pre-prologue into files that include the generated parser header file. Of course, to avoid duplicate code, the pre-prologue can be moved to its own header file. _______________________________________________ help-bison@... http://lists.gnu.org/mailman/listinfo/help-bison |
| Free embeddable forum powered by Nabble | Forum Help |