
On 2/8/2011 12:48 PM, Slide wrote:
I am looking at using Boost::Spirit for parsing a set of hardware register definitions. From the examples I have seen, it looks like one mainly creates a structure and then that is what is returned from the parsing of the input. I was wondering if anyone could point me towards some examples that might parse out a list of items and return them. The end goal is to parse in the register definitions and then generate C/C++ code from those register definitions to define a hardware access layer that can be used by my other libraries on my chip. So, I would parse the register definitions into a vector and then iterate over that vector to generate the necessary code.
Check out the examples directory. There are tons of examples there. Check out boost/libs/spirit/example/qi/num_list1.cpp up to num_list4.cpp It's fully documented in the tutorial section. Cheers, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com