eliben / pycparser

:snake: Complete C99 parser in pure Python
Other
3.26k stars 612 forks source link

Support for _Generic #559

Open edbennett opened 1 week ago

edbennett commented 1 week ago

Support for C11's _Generic has been discussed in #63 and #438, but doesn't appear to have been written yet.

I find myself with a need to use pycparser on a codebase that makes significant use of _Generics.

Are there any plans to add this support, please? Or any pointers on where I would start looking if I wanted to implement it (with the caveat that it may be beyond my skill level or time I have available to allocate to it)?

eliben commented 6 days ago

I personally don't have plans to add it, but will welcome PRs implementing it.

The place to start would be to understand how the spec defines the feature (formal grammar) and translate it into pycparser grammar rules. This typically isn't hard, but requires some understanding of parsing languages.