How to parse space-separated floats in C++ quickly?

UPDATE Since Spirit X3 is available for testing, I’ve updated the benchmarks. Meanwhile I’ve used Nonius to get statistically sound benchmarks. All charts below are available interactive online Benchmark CMake project + testdata used is on github: https://github.com/sehe/bench_float_parsing Summary: Spirit parsers are fastest. If you can use C++14 consider the experimental version Spirit X3: The … Read more

Boolean expression (grammar) parser in c++

Here is an implementation based on Boost Spirit. Because Boost Spirit generates recursive descent parsers based on expression templates, honouring the ‘idiosyncratic’ (sic) precedence rules (as mentioned by others) is quite tedious. Therefore the grammar lacks a certain elegance. Abstract Data Type I defined a tree data structure using Boost Variant’s recursive variant support, note … Read more

Boost spirit skipper issues

In general the following directives are helpful for inhibiting/switching skippers mid-grammar: qi::lexeme [ p ]which inhibits a skipper, e.g. if you want to be sure you parse an identifier without internal skips) – see also no_skip for comparison qi::raw [ p ]which parses like always, including skips, but returns the raw iterator range of the … Read more