-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort ambiguities generated by GLR Bison parsers (#4261)
The order in which the different stanzas in K's Bison parsers are generated depends on the iteration order of a Java set, which is not well defined and may be different across platforms. Normally, this isn't a problem as the location of a grammar action in the file doesn't affect whether it gets run or not for a particular input string. However, one situation in which this can present an issue is when merging ambiguities. The ordering of the two nodes present under an ambiguity _can_ be changed if the ordering of stanzas in the file changes. This manifested with #4171 causing build failures in the C semantics, and in the subsequent LLVM backend update PR #4257. The solution is to sort the two nodes that make up an ambiguity when the merge function is called; this PR implements a simple ordering function over parse tree nodes and updates related tests to respect the new consistent ordering of ambiguity nodes.
- Loading branch information
Showing
2 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
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 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