boost-spirit

Can Boost Spirit be used to parse byte stream data?

Can Spirit (part of Boost C++ library) be used to parse out binary data coming from a stream? For example, can it be used to parse data coming from a socket into structures, bytes, and individual bit flags? Thanks! ...

Boost Spirit crash when used in DLLs

I am experiencing a crash while using the Boost.Spirit and Boost.Thread libraries in my application. This only happens if I have used the Spirit parser during the lifetime of the process from the main thread. The crash happens at exit and appears to be related to the clean-up of thread specific storage allocated by the Spirit parser....

boost spirit extracting first word and store it in a vector

Hi, I have problems with Boost.Spirit parsing a string. The string looks like name1 has this and that.\n name 2 has this and that.\n na me has this and that.\n and I have to extract the names. The text "has this and that" is always the same but the name can consist of spaces therefore I can't use graph_p. 1) How do I parse s...

Is Boost guilty of being un-Boost-like?

I was just reading the intro to the Boost::Spirit LL Parser framework. The preface suggests that the author and creator likes to use such parsing technology to read in program options. Doesn't Boost have its own library for program options? I am wondering, does the Boost committee review all the library notes for common themes and style...

What are the disadvantages of the Spirit parser-generator framework from boost.org?

In several questions I've seen recommendations for the Spirit parser-generator framework from boost.org, but then in the comments there is grumbling from people using Spirit who are not happy. Will those people please stand forth and explain to the rest of us what are the drawbacks or downsides to using Spirit? ...

How do I parse this correctly with spirit?

My situation: I'm new to Spirit, I have to use VC6 and am thus using Spirit 1.6.4. I have a line that looks like this: //The Description;DESCRIPTION;; I want to put the text DESCRIPTION in a string if the line starts with //The Description;. I have something that works but looks not that elegant to me: vector<char> vDescription; //...

Unit-tests for Boost.Spirit

Hi I'm new to Boost.Spirit and Boost.Test and I would like to know how you verify the correctness of your grammars. Below is a simplified version of how I do it at the moment and I'm pretty sure that there's a better way: Each test case hase a pair of two strings containing the text to parse and the expected result delimited by semicol...

Using Iterator parsing with Boost::Spirit Grammars

When I attempt to use the iterator form of parsing for a Spirit grammar I get a argument passing conversion error from the iterator type to const char*. How do I fix this? There are some restrictions. I'm using an iterator adapter on large inputs, so it is not feasible for me to convert to a C style string. Here is sample code demons...

parser: parsing formulas in template files

I will first describe the problem and then what I currently look at, in terms of libraries. In my application, we have a set of variables that are always available. For example: TOTAL_ITEMS, PRICE, CONTRACTS, ETC (we have around 15 of them). A clients of the application would like to have certain calculations performed and displayed,...

Is there a translator tool for translating EBNF to boost::spirit?

The translator could be in boost::spirit too. I couldn't find any in the Internet. Maybe I should make one? ...

Processing Escapes using the Spirit Parser Framework

Hello :) I'm trying to parse a string similar to the following using a spirit parser: <junk> -somearg#this is a string with a literal ## in it# <junk> What I'm looking for is a grammar which can extract the portion inside the # marks, but is smart to skip over the double ## in the middle, which is an escape meaning a literal #. This ...

boost::spirit 2.0 incomplete docs?

I've just completed the boost spirit 2.0 tutorial: http://www.boost.org/doc/libs/1_39_0/libs/spirit/doc/html/index.html Only to find out that the rest of the promised documentation is completely missing. Specifically, I was really hoping for a page that contains all the available parsers and their attributes. Does anybody know where I c...

Scaling in boost::spirit's assign_a

Hey folks! I am diving into boost::spirit in order to parse a ASCII-based protocoll. I mananged to extract values from the line using rules like this: rule<> Speed = uint_parser<unsigned int,10,3,3>()[assign_a(buffer.speed)]; I also succeed to connect these rules in a meaningful manner. What is missing for a perfect day is the follow...

boost:spirit reuse rules

Hej, another question: I have written a number of very similar parsers which use a number of common rules. Can I store these rule<> objects in a place where they can be acessed by multiple parsers? It looks somehow like this: rule<> nmeaStart = ch_p('$'); rule<> nmeaAddress = alnum_p() >> alnum_p() >> !alnum_p() >> !alnum_p(); rule<> n...

I keep getting stack overflows when trying to use Spirit to parse stuff

I figured when I started getting stack overflow it was time to come here to ask ;) I'm trying to learn how to use Boost Spirit right now. I've figured out the basic stuff. Since I had K&R handy (which contains the grammar of C) I decided to see if I could make an acceptor for the language. This was more or less my original goal anyway, ...

CSV parser in C++

All I need is a good CSV file parser for C++. At this point it can really just be a comma-delimited parser (ie don't worry about escaping new lines and commas). The main need is a line-by-line parser that will return a vector for the next line each time the method is called. I found this article which looks quite promising: http://www...

Getting started guide for Boost.Spirit?

I've been looking recently at Boost.Spirit (the version included in Boost 1.39), however I'm quite confused from the docs alone. What I'm looking for is for an example of a toy language implemented with Boost.Spirit -- something along the lines of a tiny Javascript or Lua or so, where you basically create an AST and process is. I'd be ha...

How to increase the gcc executable stack size?

I have large Boost/Spirit metaprogram that is blowing gcc's stack when I try to compile it. How can I increase gcc's stack size, so I can compile this program? Note: There's no infinite recursion going on, but there is enough incidental recursion to exhaust gcc's stack. ...

Compiliation errors on boost files

I'm getting a lot of errors compiling code using the boost libraries, mainly when I'm using Spirit namespace. The errors are syntax errors on boost files like: boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<' or boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: miss...

BUG on boost spirit?

I'm trying to migrate my code from VSC++ 6 to VSC++ 2008 express edition and from Intel compiler to Microsoft compiler. Everything were easy to migrate except that I'm receiving this errors now: 1>------ Build started: Project: Base, Configuration: Debug Win32 ------ 1>Compiling... 1>DefaultScriptReader.cpp 1>Warning: This header is dep...