boostorg / boostorg/parser

Remove iostream dependency

Open
#241 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
182
Forks
28
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.