yhirose / cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library
MIT License
880 stars 112 forks source link

Dump the cpp-peglib parser PEG grammar #223

Closed yhirose closed 2 years ago

yhirose commented 2 years ago

Another interesting addition would be to have in cpp-peglib a function to dump the grammar as C++ code/calls like it's used inpeglib.h here https://github.com/yhirose/cpp-peglib/blob/fed85fe14d0d2cf83fc649a72bd55a50f28439b2/peglib.h#L3229 (chpeg has --bytecodec option).

Originally posted by @mingodad in https://github.com/yhirose/cpp-peglib/issues/221#issuecomment-1166311051

yhirose commented 2 years ago

After I pondered over the feature, it seems to be more difficult to fully implement it than I thought. It could handle only simple grammars, but hard to handle more complicated ones such as using macro and instructions. So I'll close it for now until I am convinced that it's absolutely necessary.