Iris.X4 is a modern, header-only PEG parser combinator library for C++23. It lets you write EBNF-like grammars directly in C++ with deterministic, top-down parsing (ordered choice, lookahead, greedy repetition).
X4 succeeds Boost.Spirit.X3 and is redesigned for clarity, maintainability, and performance using modern C++ features such as concepts and constexpr.
X4 scales from quick prototypes to production parsers for DSLs, data formats, and interpreters.
- C++23 and C++26
- GCC 14
- Clang 21
- MSVC 2022
Note: Boost dependency is going to be removed entirely in the near future.
cd my_app
git submodule add https://github.com/boostorg/boost.git modules/boost
cd modules/boost
git submodule add https://github.com/iris-cpp/x4.git libs/iris_x4git clone https://github.com/boostorg/boost.git
cd boost
git clone https://github.com/iris-cpp/x4.git libs/iris_x4Note: Boost dependency is going to be removed entirely in the near future.
git submodule update --init --depth 1 --recursive -- \
tools/build tools/boost_install libs/assert libs/bind libs/config \
libs/container_hash libs/core libs/describe libs/detail \
libs/function libs/function_types libs/functional libs/fusion \
libs/integer libs/io libs/mp11 libs/mpl libs/predef libs/preprocessor \
libs/static_assert libs/throw_exception libs/tuple libs/type_index \
libs/type_traits libs/typeof libs/utility libs/variant
# Linux
./bootstrap.sh
./b2 headers
# Windows
.\bootstrap.bat
.\b2 headersEdit your CMakeLists.txt:
add_subdirectory(modules/boost/libs/iris_x4)
target_link_libraries(my_app PRIVATE Iris::X4)cd iris_x4
cmake -B build