On 10/22/19 2:03 PM, Vinnie Falco via Boost wrote:
Furthermore json::basic_parser is optimized to work well for incremental inputs, Spirit on the other hand is not. But I'm no Spirit expert so if someone wants to show me how a Spirit based parser can match the hand-rolled version feature for feature at the same or better performance, that would be quite interesting.
First of all I'm not sure what you by incremental inputs. Maybe it means the same as in the serialization xml parse which I think does one phrase on demand rather than setting it up and letting'er rip. I've conceded to your decision about not using spirit rather than your hand rolled version as a component of your JSON parser. My suggestion is that you consider it for use in your test suite where dependencies are not an issue but provable correctness is. It's much easier to verify the correctness of a grammar in bnf or peg than it is to verify the correctness of a hand rolled parser. So you can make a test program in spirit which whose correctness can be statically verified and use it test same strings you use to test your hand rolled version and verify you get the exact same results. This avoids having to manually verify the correct results for every test string. And makes the process of adding a new test string trivial rather than onerous. You've described in detail your plans for ensuring that your parser is correct. The way you do it it's a huge amount of work involving many people and subject to human frailties. And the correctness of your checking can't really be verified by someone other than the person that does it. Adding more people and more work doesn't really increase confidence. Using an alternative method which is more provably correct is much more likely to smoke out a bug. And it's a lot less work too! Robert Ramey