我有類似如下的工作語法:在boost :: spirit :: qi語法中處理深遞歸的正確方法是什麼?
stock_price = symbol_ >> date_ >> price_;
stock_prices_ = stock_price_ >> stock_prices_ | eps;
grammar_ = lit("PRICES") >> stock_prices_ >> lit("END");
的問題是,當股票prices_名單過高(約1000種價格說吧),在該解析賽格故障與EXC_BAD_ACCESS。我實際上可以解決這個:
stock_prices_ = stock_price_ >> stock_price_ >> stock_price_ >> stock_price >> stock_prices_ |
stock_price_ >> stock_prices_ |
eps;
但我不認爲這是一個優雅的解決方案。有更好的解決方案嗎?
也許在probelm指數上。 20個指數模式會將遞歸深度限制在每百萬40 + 1左右。 – Yakk