Hi,
Il 07/11/19 03:18, Mario Carneiro ha scritto:
> Neither; it means that any time a particular infixy constant appears, it
> must have the same precedence. That is, if you have a notation x $e.$ A
> and another notation ${$ x $e.$ A $|$ ph $}$, then $e.$ must be given
> the same precedence in both appearances.Ok, so the reason for this is that when you found a constant while parsing at a certain minimum precedence level, you immediately know if you have to branch out or not, without having to know if the surrounding constructor is an infix or a notation? Or is there something deeper? > I think the solution is to enforce, as you will see in precedence tables > for languages like C, that "associativity" is uniquely assigned to > precedence levels, not operators. This example would be rejected because > precedence level 1 has both a right associative and a left associative > operator. Prefix operators should be treated as right-associative for > this purpose, because something like (~ (A:1) : 1) has a subterm that is > trailing (on the right) with the same precedence as itself, like a right > assoc operator would. I agree. In a C parsers I wrote some time ago I would treat prefix operators as infix operators with an empty left argument (and the opposite thing for suffix operators, since in C we have those as well). 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/765d1f14-45de-1732-2cec-5c17b68175cd%40gmail.com.
signature.asc
Description: OpenPGP digital signature
