How hanickadot/compile-time-regular-expressions works
Project type and purpose
• From the file tree and README, this is a header-only C++ library (Compile Time Regular Expressions, “ctre”) that provides compile-time regex parsing/matching built on top of a small CT parser library (ctll), plus optional Unicode support via unicode-db.
• It’s intended as an open-source developer tool/library, consumable via CMake, Conan, or vcpkg, with a single-header distribution.
File structure
• Top-level build and packaging:
• CMakeLists.txt, Makefile, conanfile.py, .travis.yml, .github/workflows/tests.yml
• packaging/ (pkgconfig template), .conan/ (Conan recipe and test package)
• Code:
• /ctll (compile-time parser primitives)
• /ctre (regex engine front-end, actions, atoms, operators)
• /unicode-db (Unicode property database interfaces)
• single-header/ (auto-generated amalgamated headers for distribution)
• Docs and examples: docs/ (Sphinx sources), README.md, NOTES.md
• Tests and benchmarks: tests/ (unit tests, regression tests, benchmarks, CI entrypoints)
• CI/build scripts: .github/, .travis.yml, clang-bench.txt, gcc-bench.txt
README for additional insights
• Describes core API (ctre::match/search/etc.), supported features, compiler compatibility, single-header generation, installation via CMake/Conan/vcpkg, and testing.
• Emphasizes two layers: ctll (generic CT parser toolkit) and ctre (regex grammar + evaluation).
a. Main components
• ctll (compile-time parser toolkit)
• ctre core (grammar definitions, action decorators, evaluation engine)
• unicode-db module (optional Unicode property lookup)
• single-header generator (Makefile/CMake script that combines include/ into single-header/)
• Build & Packaging:
– CMake targets (ctre, ctre_unicode, tests)
– Conan recipe (.conan/)
– vcpkg port
• Documentation generator (Sphinx in docs/)
• Tests & Benchmarks (tests/ and benchmark-exec/)
• CI/CD pipelines (.github/workflows/tests.yml, .travis.yml)
b. Relationships & interactions
• ctll is a prerequisite for ctre – ctre includes ctll headers under include/ctll
• ctre optionally depends on unicode-db when Unicode support is enabled
• single-header generator script reads include/ and outputs the amalgamated headers
• Build system orchestrates compilation of test executables, library targets, generation of single-header, and invocation of packaging recipes
• CI runs build, tests, benchmarks, and single-header regeneration on each push/pull request
• Docs pipeline pulls in API comments from include/ and examples in docs/
c. Architectural patterns & design principles
• Header-only library pattern for zero-link-time dependency
• Compile-time parser combinator pattern (in ctll) layered with regex grammar in ctre
• Optional modules (unicode-db) loaded via CMake options or preprocessor macros
• Single-header “amalgamation” for easy distribution
• Polyglot packaging: CMake, Conan, vcpkg
• CI/CD as code (GitHub workflows, Travis, Conan test_package)
d. Key technologies & frameworks
• C++17/C++20 template metaprogramming (CT parser, fixed_string NTTP)
• CMake and Makefile
• Conan (package recipe + test package)
• vcpkg port (externally maintained)
• Sphinx for documentation (reStructuredText)
• GitHub Actions / Travis CI for continuous integration