how do i control where bison puts c++ code?

I'm trying to control where bison outputs the prologue sections of the code while using it in c++ mode and in the defines mode (i.e. write out a header)

Basically, I have :-

%{
  // stuff that should go into the parser.tab.hxx
%}
%{
  // stuff that should go into the parser.tab.cxx
%}

I'm using bison 2.3 and don't have easy access to bison 2.5 (which seems to have some sort of functionality for doing the same).

I'm also aware that this can be done since some of the exmaples online seem to be able to achieve this... Any help?

Answers


Easy workaround: in a file with the name you want the source file to have, put

#include "parser.tab.cxx"

and nothing else. Similarly for the .hxx file. (Make sure your build system doesn't try to build all .cxx files in the directory.)


Need Your Help

Adding multiple framelayout in a linearlayout programmatically

android android-layout dynamically-generated

I need to overlap an image view with textview. And this combined view will be repeated 100 times in a LinearLayout. I was thinking of using FrameLayout in LinearLayout and Repeating the FrameLayout...

What event should I use in the IHttpModule to disable website?

c# asp.net httpmodule

I want to disable a website programatically for licensing reasons, and I want to do it in a httpmodule.

C# Type Availability - Using Application Settings Architecture across applications - Strongly Typed Config

c# .net visual-studio settings application-settings

I am looking to write a unified configuration class that aggregates the settings in multiple applications which exist from within Visual Studio's Application Settings Architecture (ASA).