473,327 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

C++, BISON, and M4

Okay.

So I've just installed Fedora core 7 fresh from my machine. It comes
with G++, and bison installed directly.

So I try to make a program that uses bison. C++ chokes with the
error:

dimensions_dat.cc:1: error: expected constructor, destructor, or type
conversion before '(' token

Looking at the first line of dimensions_dat.cc, I find the following:
b4_copyright(Skeleton parser CASA Grammar Parsing with Bison,
1984, 1989, 1990, 2000, 2001, 2002)

Commenting this line out, the error goes away.

So just comment it out and go merrily on my way, right? Nope! There
are several uses of macros very like this one, in very hard-to-reach
places in the code. Far better just to get the macros working in the
first place.

Macros -- right. Looking around, I found that these are m4 macros
(used with the m4 preprocessor) define in /usr/share/bison/c.m4 .

I think what is *supposed* to happen is that c++ is supposed to run
the m4 processor first before doing anything else. These macros are
replaced by standard code, which is then properly compiled.

However, for some reason m4 is not replacing the macro calls. Either
it doesn't know where the macros are, or the macros are mis-defined
and being rejected. Since these are standard Bison definitions which
I have not touched, I find that highly unlikely.
Suggestions? Insight? If you don't know, where would I ask to find
out?

--
Respectfully,

Brian P.

Oct 3 '07 #1
3 2777
pe*****@hotmail.com wrote:
Okay.

So I've just installed Fedora core 7 fresh from my machine. It comes
with G++, and bison installed directly.

So I try to make a program that uses bison. C++ chokes with the
error:

dimensions_dat.cc:1: error: expected constructor, destructor, or type
conversion before '(' token

Looking at the first line of dimensions_dat.cc, I find the following:
b4_copyright(Skeleton parser CASA Grammar Parsing with Bison,
1984, 1989, 1990, 2000, 2001, 2002)

Commenting this line out, the error goes away.

So just comment it out and go merrily on my way, right? Nope! There
are several uses of macros very like this one, in very hard-to-reach
places in the code. Far better just to get the macros working in the
first place.

Macros -- right. Looking around, I found that these are m4 macros
(used with the m4 preprocessor) define in /usr/share/bison/c.m4 .

I think what is *supposed* to happen is that c++ is supposed to run
the m4 processor first before doing anything else. These macros are
replaced by standard code, which is then properly compiled.

No, g++ does not call m4. Check your makefile
>
Suggestions? Insight? If you don't know, where would I ask to find
out?
Suggestion: ask in a GNU newsgroup. Try gnu.g++.help
Oct 3 '07 #2


Oct 3 '07 #3
On 2007-10-03 21:40, pe*****@hotmail.com wrote:
Okay.

So I've just installed Fedora core 7 fresh from my machine. It comes
with G++, and bison installed directly.

So I try to make a program that uses bison. C++ chokes with the
error:
If you have a problem with a specific program, post your problems in a
group/mailing-list discussing that program. Often the code comes with
files such as README or similar that will tell you how to configure and
build it, look for those files and read carefully.

--
Erik Wikström
Oct 3 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DOKNIK | last post by:
Hi, I am trying to install PHP with the Apache DSO Installation on AIX 5.1. I have successfully configured and installed Apache and can view the Test Apache page successfully The installation...
8
by: pavel.orehov | last post by:
Hi, I am using flex and bizon to write HTTP parser. I am passing well flex and bison tools but can't compile their output. ================= Flex file (http_parser.lpp) ============== %{...
3
by: Santa | last post by:
I am trying to run bison tool, I am getting "/usr/share/bison.simple: No such file or directory" error, I have file bison.simple in cygwin/bin directory, I am trying to copy into /usr/share...
4
by: daniele.calisi | last post by:
Hi everyone, after some days spent in long searches with google, I still not have found a solution with this problem: I need to use flex (or flex++) and bison (but not bison++) in order to...
3
by: John Sasso | last post by:
In my Yacc .y file I defined: %union { int value; struct Symbol Sym; } The Symbol struct I defined in a header file I #included in the Prologue section of the .y file as:
13
by: jc | last post by:
I have written a parser using bison and flex to read ASAP2 file for CAN communications. entire development was done in an unix environment and now the code is ready to be integrated to an existing...
1
by: Adam S | last post by:
I'm using bison to generate a C++ parser targeted for a microcontroller application. The command to generated C++ parser using bison is: bison --skeleton=lalr1.cc <myfile.ypp> and makes heavy...
2
by: eng.sharif | last post by:
i want use bison and flex in visual stdio 2005 for make small compiler by use Custom Build Rules in Visual C++ 2005 "FlexBison.rules file " but when i compile "example.y" i get error...
1
by: eng.sharif | last post by:
want use bison and flex in visual stdio 2005 for make small compiler by use Custom Build Rules in Visual C++ 2005 "FlexBison.rules file " but when i compile "example.y" i get error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.