Using ^ for insertions

Hello,

I’m happy to argue about the mark characters later, so I’m not trying to
prevent the next draft from using “^” for insertions since that’s what
we agreed. However, I realized that using “^” for insertions has another
consequence: it leaves no mark that means “match and insert this”.

Today,

  S: "(", "a", ")".

will match “(a)” producing, <S>(a)</S>. If I want, I can exlude some of
those literals. Now:

  S: -"(", "a", -")".

will match “(a)” producing, <S>a</S>. If I want, I can also be more
explicit about matching those literals. This:

  ^S: ^"(", "a", ^")".

still matches “(a)” and produces, <S>(a)</S>.

But if we overload “^” for insertions, then the semantics of the
previous rule change. It will only match “a” and it will produce
<S>(a)</S>.

There’s no longer a mark that means “I want to be explicit that this
literal should be matched and inserted.”

I’m not sure that’s a deal breaker, but it doesn’t sound easy to
explain.

We can’t remove “^” on nonterminals, because we need it for this use
case:

S: A, B.
-A: "a".
-B: "b"; ^A, "b".

It would be trivial to rewrite that grammar so that the “^” wasn’t
needed, but that’s necessarily going to be the case for more complicated
grammars.

There’s no corresponding use case for “^” on terminals-to-be-inserted so
I don’t think we’ve lost any functionality, but I really don’t like the
loss of symmetry.

I don’t think the observation that “^” looks a little bit like a
proofreader’s “insertion mark” really helps the explanation very much.
(If it *was* a proofer’s insertion mark, it would go below the insertion
point not before it, so it’s kind of weak at best.)

I still think “+” or even the much maligned “&” would be better.

The risk, of course, in talking about changing marks, is that it
encourages creativity where we may not want it :-).

For example, I observe that “!” is more universally recognized as “not”
than “~” (Steven even provided an anecdote to this point on the call.)
Although I recognize that “~” is a negation symbol in some mathematical
disciplines, to my mind it’s more commonly associated with
“approximately”.

You could probably sell easily me on “!” for negation in exclusions,
then we could use “~” for insertion.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Wednesday, 6 April 2022 14:51:25 UTC