-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cosmetic changes to PEG grammar. #2
Open
alanpost
wants to merge
11
commits into
lojban:master
Choose a base branch
from
alanpost:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change is consistent with operand-start, which doesn't group these rules together. This change is consistent with all other rules in operand-3, which don't try to share common-substructure. This change moves an ordered choice from the inside one choice out to the loop with the other choices. Since ordered choice is something that can be checked in parallel, this change allows more simultaneous threads to try parsing operand-3 at once.
The two choices in statement-2 differ only by the final element in the outermost optional clause. The first choice does not have statement-2, the second choice does. This can be expressed by another '?' operator, removing one ordered choice. If this rule was constructed this way in order to avoid a bug in the RATS! parser, please ignore this change.
This rule include one choice which is "a b c" and one choice which is "a b" That is the same as saying "a b c?", so combine these two choices.
This is the only choice in sumti-6 separated into it's own production. I'm not sure why it is pulled out, it is only referenced in sumti-6. If you were doing this because you wanted the parse tree shaped a particular way, please ignore this change. Otherwise, this change is more consistent with the rest of the grammar.
|b c / a b c| is the same as saying |a? b c|, except in conditions that make |a b c| never match (i.e., if |b c| always matches the same input as |a b c|). That is not the case here, these two choices can be folded into one by making the first clause optional.
space-interval contains the rule |a / b / a b|. Since the first matching choice is always taken, the last choice will never match, since a substring of that match is contained in a previous choice. reorder this rule to be |a b? / b|, which is equivalent to the *intent* to match a, or b, or a b.
e326dff is a legitimate bug: the third choice in the ordered choice will never be matched. This probably needs to have a higher priority than the other stuff. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a list of mostly cosmetic changes to the PEG grammar.