Skip to content

Remove iostream dependency #241

@daniel-starke

Description

@daniel-starke

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions