Skip to content

[spectec] Support ~ and ~_ relation symbols - #2267

Merged
rossberg merged 1 commit into
mainfrom
spectec-sim
Oct 8, 2026
Merged

rossberg merged 1 commit into
mainfrom
spectec-sim

Conversation

@tlively

@tlively tlively commented Oct 7, 2026

Copy link
Copy Markdown
Member

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).

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).
@tlively
tlively requested a review from rossberg October 7, 2026 01:08
@tlively

tlively commented Oct 7, 2026

Copy link
Copy Markdown
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 rossberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 ¬...

@rossberg
rossberg merged commit 6418777 into main Oct 8, 2026
11 checks passed
@rossberg
rossberg deleted the spectec-sim branch October 8, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants