C23 support by olehlo · Pull Request #293 · tree-sitter/tree-sitter-c · GitHub
Skip to content

C23 support#293

Open
olehlo wants to merge 2 commits into
tree-sitter:masterfrom
olehlo:c23-support
Open

C23 support#293
olehlo wants to merge 2 commits into
tree-sitter:masterfrom
olehlo:c23-support

Conversation

@olehlo

@olehlo olehlo commented Dec 11, 2025

Copy link
Copy Markdown

Adds missing C23 support.

Closes #290
Closes #273
Closes #261

@olehlo olehlo force-pushed the c23-support branch 9 times, most recently from b44e833 to 2154e4f Compare December 11, 2025 11:34
@zhaob1n

zhaob1n commented Dec 16, 2025

Copy link
Copy Markdown

@olehlo

olehlo commented Dec 16, 2025

Copy link
Copy Markdown
Author

Hey!
Perhaps _Countof should not be a part of this PR at all? With a separate PR for C2Y support with _Defer, _Countof?

@zhaob1n

zhaob1n commented Dec 16, 2025

Copy link
Copy Markdown

Hey! Perhaps _Countof should not be a part of this PR at all? With a separate PR for C2Y support with _Defer, _Countof?

Yes I think so.

@olehlo olehlo force-pushed the c23-support branch 2 times, most recently from 3b34bb4 to 216df82 Compare December 16, 2025 10:26
This commit adds support for new types, preprocessor directives,
keywords added in C23.
Also allows arbitrary amount of types to be passed into a macro,
enhancing support for "generic" macros in C23/C2Y (N3037, N3332).

Keywords, types, directives added:
- "auto" type
- _BitInt(N), _FloatN, FloatNx, _DecimalN, _DecimalNx
- typeof, typeof_unqual, countof, _Countof, alignof, alignas,
static_assert, _Static_assert
- #embed, #warning, #error, #elifdef, #elifndef
Comment thread grammar.js

@narpfel narpfel May 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this is correct: typeof(...) is not an expression but a type-specifier. I. e. typeof(42) + 1; is allowed by this grammar and typeof(42) x = 1; is not allowed when it should be the opposite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Support C23 new primitive types like _Float32 feature: Support for C23's typeof() feature: c23 _BitInt(N) and auto support

3 participants