Hi,

Il 07/11/19 14:51, Benoit ha scritto:
> There is something I do not understand: to me, it is operations which
> have a precedence, not expressions.  Or is there a rule to attribute a
> precedence to an expression in terms of the precedence of its root
> operation?

Yes, I'd say expressions have the precedence of their root symbol. See
also the explicit grammar written by Mario in MM0 docs:

  https://github.com/digama0/mm0/blob/master/mm0.md#secondary-parsing

> Take two laws, * and +, which have the same precedence. Then, how do you
> decide how to parse "a * b + c"?  Here, left- or right-associativity is
> irrelevant since each law is used only once.

I'd say that's the point Mario is making: associativity has to be given
to the precedence level, not to the individual operators. So if you want
* and + to be at the same precedence level, they also have to have the
same associativity. If they are both left-associating, then your
expression will be parsed as (a * b) + c, if they are both
right-associating it will a * (b + c). From the point of associativity,
you assume all the operators at the same precedence level to associate
together.

Also, as Mario noted, infix operator should be treated as
right-associating, and conversely postfix operator should be treated as
left-associating (but, fortunately, MM0 does not allow them).

HTH, Giovanni.
-- 
Giovanni Mascellani <[email protected]>
Postdoc researcher - Université Libre de Bruxelles

-- 
You received this message because you are subscribed to the Google Groups 
"Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/metamath/c5fda6fa-1dda-bd93-d218-9da7921d2afd%40gmail.com.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to