Repository navigation
[spectec] Support ~ and ~_ relation symbols - #2267
Merged
Merged
Conversation
Add support for ~ and ~_ relation symbols (sim and sim_). To avoid a grammar ambiguity between unary logical negation (~ e) and prefix relations without a left-hand side, introduce relop_prefix which excludes ~. In infix position (e1 ~ e2), ~ is parsed as a binary relation (Atom.Sim), while in prefix position (~ e), ~ remains parsed as unary negation (unop).
Member
Author
|
@rossberg, this is the new operator you suggested using in WebAssembly/custom-descriptors#101 (comment). I wasn't sure whether you would prefer the spectec PR here upstream first or in the custom-descriptors repo. Landing it here would mean a smaller diff to the custom descriptors repo, so I think that would be slightly nicer. |
rossberg
approved these changes
Oct 8, 2026
rossberg
left a comment
Member
There was a problem hiding this comment.
Mh, yeah, the clash/irregularity with logical negation is a bit unfortunate, but probably okay. Perhaps we should find a more appropriate ASCII spelling for ¬...
This file contains hidden or 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
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.
Add support for ~ and ~_ relation symbols (sim and sim_).
To avoid a grammar ambiguity between unary logical negation (~ e)
and prefix relations without a left-hand side, introduce relop_prefix
which excludes
. In infix position (e1 ~ e2), ~ is parsed as a binarye), ~ remains parsedrelation (Atom.Sim), while in prefix position (
as unary negation (unop).