Skip to content
New issue

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

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

Already on GitHub? # to your account

Separate types for token kinds and node kinds #83

Open
lunacookies opened this issue Jan 17, 2021 · 0 comments
Open

Separate types for token kinds and node kinds #83

lunacookies opened this issue Jan 17, 2021 · 0 comments

Comments

@lunacookies
Copy link

Although using a single type for both (SyntaxKind) is easier, it doesn’t make illegal states unrepresentable. For example, if I’m matching on a SyntaxKind produced by my lexer, I know that the kind cannot be one of SyntaxKind’s node variants, e.g. BinaryExpr. Similarly, when I’m deciding what kind to give a node, I shouldn’t be able to create a node of kind LetKw.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant