https://github.com/jpenuchot/poacher
poacher: C++ compile-time compiling experiments
https://github.com/jpenuchot/poacher
brainfuck compilation cpp cpp20 cpp23 metaprogramming parser
Last synced: about 1 year ago
JSON representation
poacher: C++ compile-time compiling experiments
- Host: GitHub
- URL: https://github.com/jpenuchot/poacher
- Owner: JPenuchot
- Created: 2020-12-01T16:13:28.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T22:34:31.000Z (over 1 year ago)
- Last Synced: 2025-04-25T01:56:09.998Z (about 1 year ago)
- Topics: brainfuck, compilation, cpp, cpp20, cpp23, metaprogramming, parser
- Language: C++
- Homepage:
- Size: 2.52 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `poacher`
C++ compile-time compiling experiments.
## Objectives
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](https://github.com/peter-winter/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](https://github.com/hanickadot) on compile-time regular
expressions and some great pioneering by [Jason Turner and Ben Deane](
https://github.com/lefticus/constexpr_all_the_things/tree/master/src/include)
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.
## Requirements
- [C'est](https://github.com/pkeir/cest)
## References
- [A totally constexpr standard library - Paul Keir, Joel Falcou et al - Meeting C++ 2022](
https://www.youtube.com/watch?v=ekFPm7e__vI)
- [Constexpr All The Things](
https://github.com/lefticus/constexpr_all_the_things)
- [Jean Privat's courses on compiling & LR(1) parsing](
https://info.uqam.ca/~privat/INF5000/)
- [ctpg](https://github.com/peter-winter/ctpg)
- [Dragon Book](https://suif.stanford.edu/dragonbook/)
## Discuss
Head over to our [Discord](https://discord.gg/mtn8dmB5qP) and don't hesitate
to mention me (@JPenuchot) if you have any question regarding the project.
## Licensing
>TODO