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

Cocos2d touch dispatcher causing object retain

ios cocos2d-iphone touch dealloc

I have a problem with cocos2d. I made a class which receives touches. Class is a subclass of CCLayer and init looks like so:

Python dictionary keys besides strings and integers?

python dictionary

Anyone have some neat examples of dictionaries with some interesting keys (besides the canonical string or integer), and how you used these in your program?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.