C++ compile-time compiling experiments.
Exploring arbitrary eDSLs in C++20, from parsing to codegen.
Poacher used to be a project aiming towards a compile-time parser generator that works in constexpr functions, but this need is almost fulfilled by ctpg. Several issues remain and make the ctpg incompatible with constexpr functions, but I'm also working on fixing that.
Yet I'm still working on handmade parsers (such as the Brainfog parser that is fully functional), data structures for ASTs, ways to go from value-based data to type-based data, etc.
For the record, here's the previous "objectives" narrative that was written a while ago:
constexpr
computation is all the rage in post-C++17 world. Works by
Hana Dusikova on compile-time regular
expressions and some great pioneering by Jason Turner and Ben Deane
show that parsing arbitrary data or langages from compile-time available
strings is a very valuable technique.
Poacher has the goal to provide an extensible framework to easily define such constexpr parsers for arbitrary langages and to provide some well known langages ready-to-use compile time parsers.
Our goal is to implement a constexpr parser generator for LR(1) grammars. Such grammars can express complex languages such as OCaml, Haskell, or any other language recognized by a parser generated by programs such as Yacc, Menhir, or Happy.
- A totally constexpr standard library - Paul Keir, Joel Falcou et al - Meeting C++ 2022
- Constexpr All The Things
- Jean Privat's courses on compiling & LR(1) parsing
- ctpg
- Dragon Book
Head over to our Discord and don't hesitate to mention me (@JPenuchot) if you have any question regarding the project.
TODO