473,811 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parser Generator for C++

Hi all,

I need to create a parser in C++ which should parse a somewhat complex
file structure. Yeah, it would be possible to write it from scratch in
C++ however I think it would be easier and the end-result would
probably be more efficient if I use a parser generator. However, I only
know flex/bison from a project in C along time ago. Any ideas on what
to use nowadays and for C++ would be nice.

Cheers,

Paulo Matos

Jul 23 '05 #1
12 2653
pmatos wrote:
I need to create a parser in C++ which should parse a somewhat complex
file structure. Yeah, it would be possible to write it from scratch in
C++ however I think it would be easier and the end-result would
probably be more efficient if I use a parser generator. However, I only
know flex/bison from a project in C along time ago. Any ideas on what
to use nowadays and for C++ would be nice.


AFAIK people who care and who can define the grammar of their files still
use lex/yacc (or their equivalents) to do the job.

V
Jul 23 '05 #2
pmatos wrote:
Hi all,

I need to create a parser in C++ which should parse a somewhat complex
file structure. Yeah, it would be possible to write it from scratch in
C++ however I think it would be easier and the end-result would
probably be more efficient if I use a parser generator. However, I
only know flex/bison from a project in C along time ago. Any ideas on
what to use nowadays and for C++ would be nice.


How about boost.spirit at http://www.boost.org/libs/spirit/index.html

Jeff F
Jul 23 '05 #3
Victor Bazarov wrote:
pmatos wrote:
I need to create a parser in C++ which should parse a somewhat complex
file structure. Yeah, it would be possible to write it from scratch in
C++ however I think it would be easier and the end-result would
probably be more efficient if I use a parser generator. However, I only
know flex/bison from a project in C along time ago. Any ideas on what
to use nowadays and for C++ would be nice.

AFAIK people who care and who can define the grammar of their files still
use lex/yacc (or their equivalents) to do the job.

V


We had to use a flex/bison parser for a C++ project and had a hard time
calming the compiler to compile the generated code at all (g++)...
I think his question was reasonable and I'd be interested, too, if there
is such a thing for C++.

--
Regards,
Matthias
Jul 23 '05 #4
Matthias wrote:
We had to use a flex/bison parser for a C++ project and had a hard time
calming the compiler to compile the generated code at all (g++)...
I think his question was reasonable and I'd be interested, too, if there
is such a thing for C++.


did you look at bison++ ?

aaryal

Jul 23 '05 #5
Anoop Aryal wrote:
Matthias wrote:
We had to use a flex/bison parser for a C++ project and had a hard time
calming the compiler to compile the generated code at all (g++)...
I think his question was reasonable and I'd be interested, too, if there
is such a thing for C++.

did you look at bison++ ?

aaryal


No joke? :D
Haven't heard of it yet, but sounds quite like what I'm looking for, thanks!

--
Regards,
Matthias
Jul 23 '05 #6

"Matthias" <no****@digital raid.com> wrote in message
news:cu******** *****@news.t-online.com...
Victor Bazarov wrote:
pmatos wrote:
I need to create a parser in C++ which should parse a somewhat complex
file structure. Yeah, it would be possible to write it from scratch in
C++ however I think it would be easier and the end-result would
probably be more efficient if I use a parser generator. However, I only
know flex/bison from a project in C along time ago. Any ideas on what
to use nowadays and for C++ would be nice.

AFAIK people who care and who can define the grammar of their files still use lex/yacc (or their equivalents) to do the job.

V


We had to use a flex/bison parser for a C++ project and had a hard time
calming the compiler to compile the generated code at all (g++)...
I think his question was reasonable and I'd be interested, too, if there
is such a thing for C++.


I´d refer to COCO (www.ssw.uni-linz.ac.at/Research/Projects/Coco/) which
will create code for C, C++, Pascal, C#, Java, etc....

Chris
Jul 23 '05 #7
Hi, seems
http://www.mactech.com/articles/mact...gFlexandBison/
used flex and bison with C++, never tried but if you say it isn't worth
it because resulting code is not g++ complaint, then I'll not even try.

Thanks for the remark,

Paulo Matos

Jul 23 '05 #8
Have you tried it yet? Is it nice?

Cheers,

Paulo Matos

Jul 23 '05 #9
pmatos wrote:
Hi, seems
http://www.mactech.com/articles/mact...gFlexandBison/
used flex and bison with C++, never tried but if you say it isn't worth
it because resulting code is not g++ complaint, then I'll not even try.

Thanks for the remark,

Paulo Matos


Well, at least I have to disable all warnings and the -pedantic flag, as
well as declaring some functions as extern "C" to make the compiler
happy. But it works, if you can live with that :)

But at least three suggestions have been posted by the fellow posters
which sound very appropriate for your purpose, so I guess you're better
off with those pure C++ solutions.

--
Regards,
Matthias
Jul 23 '05 #10

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

Similar topics

2
429
by: alederer | last post by:
Hallo! Does anybody know a parser generator that supports unicode (UTF-16), and is based on something like ICU. The parser is used in a platform independent and cross-platform communicating application. thanks andreas
3
1759
by: Jang | last post by:
Could anyone point or send me a syntax of C which fits to Parser Generator (YAAC) ? I've got a big problem because I have to write a translator C ->assembler :[ There is a lot of work to convert rules in BNF to YAAC. How to deal with it ? Thank in advance.
0
972
by: jozo | last post by:
I am using bumblebee software PARSER GENERATOR to make a C file from LEX regular definitions. I want to compile that C file with VS .NET but I have problems. Does somebody know how to configure a project to work? Thanks
0
1414
by: Marcel Linnenfelser | last post by:
Hi there, anyone interested in a php written and outputting LALR(1) parser generator, especially in testing it? I already posted this request in the german newsgroup a few days ago. I noticed some (ca 50) requests on the provided link but no answers so far. Two test grammars are included in the package. The grammar for the grammar files and a grammar for a php specific EL (like Expression
6
2745
by: Mike C# | last post by:
Hi all, Can anyone recommend a good and *easy to use* lexer and parser generator? Preferably one that was written specifically for VC++ and not mangled through 20 different platforms. I've had it up to here (funny hand gesture) with trying to compile the bullet-riddled code that GNU Flex and Bison keep spitting out for even the simplest of grammars (really funny hand gesture). Thanks
9
3627
by: Peter Michaux | last post by:
Hi, Does a parser generator exist that generates JavaScript code? Most parser generators generate C or Java code. Thanks, Peter
20
1868
by: Jack | last post by:
Hi all, I need to do syntax parsing of simple naturual languages, for example, "weather of London" or "what is the time", simple things like these, with Unicode support in the syntax. In Java, there are JavaCC, Antlr, etc. I wonder what people use in Python? Antlr also has Python support but I'm not sure how good it is. Comments/hints are welcome.
1
2029
by: seaside | last post by:
Hi, I'll probably release a php5-based LL(1) parser generator - if there is general interest. Please post a comment, in case... Some details: - Pure PHP5 - Parses LL(1) - Lexical definitions using regular expresions
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.