0

What does the 'at next level' bit mean in the following notation (given that the level is already specified):

Reserved Notation "t1 ->> t2" (left associativity, at level 69, t2 at next level). 
...
where "t1 ->> t2" := (xform t1 t2).

where xform is a function defined in between.

Anon
  • 381
  • 1
  • 2
  • 13

1 Answers1

2

Consider a ->> b ->> c. There are two ways to parse it, either t1 is a and t2 is b ->> c, or t1 is a ->> b and t2 is c. Because t2 is marked at next level, only a notation with a level lower than 69 can be used in there, which makes b ->> c impossible (unless parenthesized). So, a ->> b ->> c is parsed as (a ->> b) ->> c.

Note that t2 at next level is redundant in the above notation. Indeed, attribute left associative already forces at next level on the term at the right end. (While right associativity forces at next level on the term at the left end.)

Guillaume Melquiond
  • 1,243
  • 4
  • 11
  • Thanks, but I actually don't understand what 'at next level' means? Does it mean that notations inside t2 will get level 69 + 1 = 70? (But what if such a notation was already predefined a level when it was defined, then will it be 70 or would it be it's level when the notation was defined? – Anon Aug 27 '20 at 12:27
  • 1
    Consider `a ->> b ->> c`. There are two ways to parse it, either `t1` is `a` and `t2` is `b ->> c`, or `t1` is `a ->> b` and `t2` is `c`. Because `t2` is `at next level`, the level 69 of `b ->> c` makes it incompatible with it. So, `a ->> b ->> c` is parsed as `(a ->> b) ->> c`. – Guillaume Melquiond Aug 27 '20 at 13:31
  • 1
    `at next level` means "at next *lower* level", since lower levels bind tighter than higher layers. `t2` is parsed at level 68. This prevents `->>` from appearing at top level in `t2`, since it requires level 69. So `a ->> b ->> c` can't be `a ->> (b ->> c)`, since `b ->> c` is at level 69 but `a ->> _` needs it to be at level 68. Instead it is parsed as `(a ->> b) ->> c`. – HTNW Aug 27 '20 at 14:19
  • Could you please consider adding it to your answer, as—in my opinion—your comment is actually the answer to the original question. – Théo Winterhalter Aug 27 '20 at 21:49