#  Where can I download the EBNF syntax description document for C++ syntax parser by clang?

**URL:** <https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614>\
**Category:** Using Clang\
**Tags:** clang\
**Created:** [July 29, 2025, 5:36pm UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614 "2025-07-29T17:36:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangchaoFree](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/yangchaofree/32/25385_2.png) [@yangchaoFree](https://discourse.llvm.org/u/yangchaoFree)\
**Post date:** [July 29, 2025, 5:36pm UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614/1 "2025-07-29T17:36:16Z")

</div>

Where can I download the EBNF syntax description document for C++ syntax parser by clang?

---

<div class="post-metadata">

**Author:** ![efriedma-quic](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/efriedma-quic/32/2053_2.png) [@efriedma-quic](https://discourse.llvm.org/u/efriedma-quic)\
**Post date:** [July 29, 2025, 5:51pm UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614/2 "2025-07-29T17:51:32Z")

</div>

clang does not include a document like that.

Like most C++ parsers, clang’s parser is a hand-written recursive-descent parser, so there’s no way to automatically extract a machine-parsable description of the grammar. And trying to write one by hand wouldn’t really be productive.

---

<div class="post-metadata">

**Author:** ![Endill](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/endill/32/13614_2.png) [@Endill](https://discourse.llvm.org/u/Endill)\
**Post date:** [July 29, 2025, 7:33pm UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614/3 "2025-07-29T19:33:33Z")

</div>

I’m not sure how one would express in EBNF parsing decisions based on semantic analysis and tentative parsing, e.g in `identifier < identifier` or “most vexing parse” situations.

---

<div class="post-metadata">

**Author:** ![yangchaoFree](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/yangchaofree/32/25385_2.png) [@yangchaoFree](https://discourse.llvm.org/u/yangchaoFree)\
**Post date:** [July 30, 2025, 1:30am UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614/4 "2025-07-30T01:30:16Z")

</div>

Without a grammar standard (assuming described using EBNF), how can I know the semantics of each node in AST?

for example, from DeclNodes.td:  
def Named : Decl\<1\>;  
…  
….def Value : DDecl\<Named, 1\>;  
……..def EnumConstant : DDecl;  
…  
….def Template : DDecl\<Named, 1\>;  
……..def RedeclarableTemplate : DDecl\<Template, 1\>;  
……..def FunctionTemplate : DDecl;  
……..def ClassTemplate : DDecl;  
……..def VarTemplate : DDecl;  
…  
How do I know the meaning of the “RedeclarableTemplate” ?

---

<div class="post-metadata">

**Author:** ![Endill](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/endill/32/13614_2.png) [@Endill](https://discourse.llvm.org/u/Endill)\
**Post date:** [July 30, 2025, 3:29am UTC](https://discourse.llvm.org/t/where-can-i-download-the-ebnf-syntax-description-document-for-c-syntax-parser-by-clang/87614/5 "2025-07-30T03:29:17Z")

</div>

I feel like there’s some confusion about what Clang AST is. As someone else aptly put it, it’s a wrongly named concrete semantic graph.

> [@yangchaoFree](#):
>
> Without a grammar standard (assuming described using EBNF), how can I know the semantics of each node in AST?

> [@yangchaoFree](#):
>
> How do I know the meaning of the “RedeclarableTemplate” ?

Answering those questions directly, by the time you see an e.g. `RedeclarableTemplate` node, parser has already decided on the semantic of the corresponding preprocessing tokens by picking that kind of node over a different kind of node.
