converting bison to boost::spirit

Hello all: I have a server I am trying to rewrite, but it uses bison to generate the parser. I know near to nothing about either of these, and the examples kind of confuse me. Is there a way that I can somehow convert the bison to boost::spirit for parsing? Also: I'm kind of curious how one would go about making a parser with boost::spirit. So I define my tokens, (lets say I want to make a calculator as it's pretty simple). Then I would need to generate a tree, correct? My first thought was to just use the [] operator to pass in a function to receive the tokens, then push it to a vector, but that seems like it would be really slow when it comes to parsing the tokens. I also know of an abstract syntax tree, but I'm kind of confused how that works and how spirit would work with it. The calculator overloaded a lot of operators, but I sort of got lost down the line in terms of what was supposed to be happening. Anyone willing to explain this would be greatly appreciated. -- Thanks, Ty

On 04/27/2011 09:37 AM, Littlefield, Tyler wrote:
Hello all: I have a server I am trying to rewrite, but it uses bison to generate the parser. I know near to nothing about either of these, and the examples kind of confuse me. Is there a way that I can somehow convert the bison to boost::spirit for parsing? Also: I'm kind of curious how one would go about making a parser with boost::spirit. So I define my tokens, (lets say I want to make a calculator as it's pretty simple). Then I would need to generate a tree, correct? My first thought was to just use the [] operator to pass in a function to receive the tokens, then push it to a vector, but that seems like it would be really slow when it comes to parsing the tokens. I also know of an abstract syntax tree, but I'm kind of confused how that works and how spirit would work with it. The calculator overloaded a lot of operators, but I sort of got lost down the line in terms of what was supposed to be happening. Anyone willing to explain this would be greatly appreciated.
Hi Ty - It looks like you are just getting started with Qi. You may find that my boostcon'10 presentation on Spirit will get you up-to-speed quickly. You can find the slides here: http://www.objectmodelingdesigns.com/boostcon10/ and the video of the talk here: http://blip.tv/file/4143337 There is an active Spirit ML that responds quickly to questions. The Spirit web site also has a lot of information: http://boost-spirit.com/home/ michael -- In the Sacramento/Folsom area? ** Profesional C++ Training mid-May ** http://www.objectmodelingdesigns.com/boostcon_deal.html Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com
participants (2)
-
Littlefield, Tyler
-
Michael Caisse