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

Implement the current set of rules for precedence partial ordering #1096

Merged
merged 7 commits into from
Mar 3, 2022
Merged

Implement the current set of rules for precedence partial ordering #1096

merged 7 commits into from
Mar 3, 2022

Conversation

zygoloid
Copy link
Contributor

In the process, switch to an unambiguous grammar, using the
precedence-climbing method for operator precedence (suitably modified to
handle a partial precedence order) rather than Bison %precedence /
%prec.

In the process, switch to an unambiguous grammar, using the
precedence-climbing method for operator precedence (suitably modified to
handle a partial precedence order) rather than Bison %precedence /
%prec.
@zygoloid zygoloid added the explorer Action items related to Carbon explorer code label Feb 23, 2022
@zygoloid zygoloid requested a review from a team as a code owner February 23, 2022 22:32
executable_semantics/syntax/parser.ypp Show resolved Hide resolved
executable_semantics/syntax/parser.ypp Outdated Show resolved Hide resolved
executable_semantics/syntax/parser.ypp Outdated Show resolved Hide resolved
executable_semantics/syntax/parser.ypp Show resolved Hide resolved
@zygoloid
Copy link
Contributor Author

@geoffromer I've reworked the presentation here and moved most of the description to README.md in an attempt to address your comments. What do you think?

executable_semantics/syntax/README.md Outdated Show resolved Hide resolved
@@ -15,3 +15,134 @@ techniques can be applied to other kinds of AST nodes as needed. See the
handling of the `UNIMPL_EXAMPLE` token for an example of how this is done, and
see [`unimplemented_example_test.cpp`](unimplemented_example_test.cpp) for an
example of how to test it.

## Precedence and associativity
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking comment: reading this section, I still have a hard time working out what rules I should follow when adding/modifying grammar rules, or conversely how to read grammar rules to understand the structure they describe. I think part of the issue is that the "what" (as opposed to "why") part is split between the idealised rules on lines 45-63 and the modifications to that ideal on lines 96-102.

However, I'm not sure that trying to wordsmith this is a good use of time right now; we'll probably have a better idea of how to clarify this once we've worked with it for a while. I think all the necessary information is here (modulo my question below), and that's probably enough for now.

@zygoloid zygoloid merged commit 65c152c into carbon-language:trunk Mar 3, 2022
@zygoloid zygoloid deleted the exec-sema-precedence branch March 11, 2022 01:04
chandlerc pushed a commit that referenced this pull request Jun 28, 2022
…1096)

In the process, switch to an unambiguous grammar, using the
precedence-climbing method for operator precedence (suitably modified to
handle a partial precedence order) rather than Bison %precedence /
%prec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants