Skip to content

Remove Grammar doc comments #1420

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

Merged
merged 1 commit into from
Jul 23, 2023
Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 17, 2023

These grammars were most of the time incomplete, incorrect and in the case of recovery wrong by definition. Instead of having misleading doc comments, let’s delete them entirely.

@ahoppen
Copy link
Member Author

ahoppen commented Mar 17, 2023

@swift-ci Please test

@WowbaggersLiquidLunch
Copy link
Contributor

As incorrect as some of them are, I did find them quite useful. These comments helped me trace down what I needed (to use/change) for #1414. I'm not really opposed to this PR, but I do kind of worry that once they're deleted, the correct ones won't be added back.

Also as far as I understand, it's sometimes necessary for the parser's logic to deviate from the grammar, in order to produce good diagnostics. I wonder if there is a good way to document both the correct grammar and the looser grammar the parser uses, and the relation between their production rules?

@ahoppen
Copy link
Member Author

ahoppen commented Mar 22, 2023

Thinking more about this, the path forward here should be to generate a grammar for the Swift language from the syntax nodes because they will automatically be kept up-to-date if the layout of the syntax tree changes.

@ahoppen
Copy link
Member Author

ahoppen commented Jun 15, 2023

@WowbaggersLiquidLunch I’m generating the grammar in #1771. Do you think that would be a sufficient replacement of the current comments?

@WowbaggersLiquidLunch
Copy link
Contributor

@WowbaggersLiquidLunch I’m generating the grammar in #1771. Do you think that would be a sufficient replacement of the current comments?

I think #1771 is a good approach in general. I left some comments in the PR there.

One of the comments I want to highlight is that the new Grammar section uses a lot of the parser's type/protocol names instead of the actual grammar components' names. I don't know if it's possible to generate it, but it's be really helpful to have a translation table between the types/protocols and the syntactic categories.

@ahoppen ahoppen force-pushed the ahoppen/no-grammar branch 2 times, most recently from 150a228 to 4cc6fae Compare July 9, 2023 06:40
@ahoppen
Copy link
Member Author

ahoppen commented Jul 9, 2023

@swift-ci Please test

These grammars were most of the time incomplete, incorrect and in the case of recovery wrong by definition. Instead of having misleading doc comments, let’s delete them entirely.
@ahoppen ahoppen force-pushed the ahoppen/no-grammar branch from 4cc6fae to 9945b3e Compare July 23, 2023 03:25
@ahoppen
Copy link
Member Author

ahoppen commented Jul 23, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit 95b2677 into swiftlang:main Jul 23, 2023
@ahoppen ahoppen deleted the ahoppen/no-grammar branch July 23, 2023 15:35
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.

3 participants