Remove iostream dependency
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- performance
Research direction
Start in parser.hpp, focusing on detail::print_parser() and parser.call(), where the issue identifies std::ostream and std::stringstream usage. Compare the existing error-reporting path with the printf()-based examples and the reported static executable sizes. Done means the iostream dependency is removed or made customizable without losing the requested error reporting behavior.
Written by the indexing model from the issue text.
Description
The current implementation uses std::ostream in detail::print_parser() and std::stringstream in parser.call() for error reporing. For static linked executables this brings in the whole locale mashinary of STL. Something not always desirable. I suggest replacing it or at least make it customizable whether to use iostreams or not.
I have made two examples with such a parser using printf() for error reporting:
lit('{') > int_ > lit(',') > int_ > lit('}')
Boost Spirit X3 results in a 154 KiB executable and Boost Parser in 218 KiB with error reporting removed in parser.hpp and 963 KiB with error reporting included.
Both compiled with GCC 15.1 for MinGW-W64 using -O2 -ffunction-sections -fdata-sections -s -static -Wl,--gc-sections. LTO makes hardly any difference here.
- Dominant language
- C++
- Stars
- 182
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/parser
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 20/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
duckdb/duckdb-wasm#2258 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo-graphs#75 ·
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Opencoarray
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FISCO-BCOS/FISCO-BCOS#5642 ·