Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify difference between SyntaxNodeKind and syntactic category #242

Open
sgraf812 opened this issue Jan 10, 2025 · 1 comment
Open

Clarify difference between SyntaxNodeKind and syntactic category #242

sgraf812 opened this issue Jan 10, 2025 · 1 comment
Labels
doc-request Request for missing documenation

Comments

@sgraf812
Copy link

What question should the reference manual answer?

I'm reading up on macros. Just as last time I did so, I got confused about the difference between a node's "syntax kind" and "syntactic categories". Could the manual entry for "syntax kind" (which btw. simply points to the node constructor ATM instead of SyntaxNodeKind) have a sentence to distinguish the two? Could there be an additional sentence involving an example?

Additional context

From grepping around I think that "syntax kind" corresponds to the name of an AST data constructor in parsers that I'm used to, and "syntactic category" (the entry of which is crisp) is the open data type into which such a constructor injects. Not sure if that's a useful analogy, especially if you have never heard of abstract syntax trees.

@sgraf812 sgraf812 added the doc-request Request for missing documenation label Jan 10, 2025
@david-christiansen
Copy link
Collaborator

This is a great thing to add - thanks for pointing it out.

I think your understanding is correct here.

In traditional grammar lingo, a syntax category is a nonterminal and a syntax kind is essentially a named production. The correspondence isn't 100% but that's quite close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-request Request for missing documenation
Projects
None yet
Development

No branches or pull requests

2 participants