-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
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.
used in the real grammar.
@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? |
@@ -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 |
There was a problem hiding this comment.
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.
…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.
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
.