Expressive Compile Time Parsers
summary
Claim is that compile time parsers let C++ accept custom DSLs with zero runtime overhead by moving parsing into constexpr and using existing compilers. The talk compares libraries boost metaparse, Lexi, CTRE, ctpg, macro_rules, ycp, shows techniques like constexpr strings, LL1/LR1 tables as bitsets, and reflection via resolve_identifier. It builds SQL->lambda, typescript-like struct generator, and compile-time JSON with a fixed allocator that works but requires compile-time input and structural public members; benchmarks show 14 seconds for 1,000 structs and ~1.5s rebuild diff.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:25What is a parser
- 3:14Expressiveness in C++ and DSLs
- 6:10Compile-time vs runtime parsing
- 9:19Boost.MetaParse
- 13:57Lexi: C++17 parser combinators
- 17:09CTRE: C++17 regex
- 20:23CTPG: C++17 LR(1) parser
- 24:02MacroRules: C++23 Rust macros
- 27:38Custom compile-time parser library
- 30:28Reflection and compile-time parsing
- 33:43Nested data member access
- 37:45Extending syntax with operators
- 44:02Creating types from strings
- 46:12Compile-time JSON tree
- 49:02Choosing the right library
- 51:09Compile-time error handling
- 52:33Compile-time performance
- 55:43Future of compile-time parsing
- 57:29Closing remarks and Q&A
related talks
01h 18mExpressive Compile-Time Parsers in C++
45mC++ is a Metacompiler
01h 03mCompile-Time Regular Expressions
01h 09m“Compile-time programming and reflection in C++20 and beyond”
01h 10m“constexpr ALL the Things!”
53m“Parsing C++”
59mThe Power Of Compile-Time Resources
46mWhat FP Can Learn From Static Introspection
