> > What do the colons and digits mean in " ((A:2) -> (B:1) : 1) " ? >> > > They are annotating the precedence levels of subterms. It's basically a > shorthand for the CFG rule > > expr(1) <- expr(2) "->" expr(1) > > where "expr(1)" is the nonterminal corresponding to expressions with > precedence >= 1. >
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? How do you parse " a * b + c " if both laws have the same precedence ? >> > > It is also generally agreed that * has higher precedence than + , so a * b > + c means (a * b) + c and a + b * c means a + (b * c). > 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. Or maybe we have different definitions of left/rigth-associativity? To me, saying that * is left-associative means that "a * b * c" is to be read as "( a * b ) * c", and nothing more than that. It seems that to you, there is an additional meaning: if * and + have the same precedence and are both left-associative, then " a * b + c " is to be read as " ( a * b ) + c". It seems a bit abusive compared to the original meaning of the word "associative". Is this general practice in the field of computer science? Thanks, Benoit -- 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/98fe200a-0e3e-4836-ba28-988854b8ae18%40googlegroups.com.
