What is the proper way to deal with deep recursion in boost::spirit::qi grammar?

Viewed 146

I have a working grammar similar to the following:

stock_price = symbol_ >> date_ >> price_;
stock_prices_ = stock_price_ >> stock_prices_ | eps;
grammar_ = lit( "PRICES" ) >> stock_prices_ >> lit( "END" );

The problem is, when the list of stock prices_ gets too high (say around 1000 prices), the the parses seg-faults with a exc_bad_access. I can actually solve this by:

stock_prices_ = stock_price_ >> stock_price_ >> stock_price_ >> stock_price >> stock_prices_ |
                stock_price_ >> stock_prices_ |
                eps;

but I don't see this as an elegant solution. Is there a better solution?

1 Answers
Related